:root {
  --ink: #1c1c1b;
  --ink-2: #3d3d39;
  --muted: #6a6a64;
  --orange: #df731d;
  --orange-soft: color-mix(in srgb, var(--orange) 14%, #fff);
  --bg: #efefec;
  --card: #fff;
  --line-2: #cfcfc8;
  --bad: #b3261e;
  --r-lg: 22px;
  --r-md: 14px;
  --shadow: 0 1px 2px rgb(20 20 18 / .05), 0 10px 28px -10px rgb(20 20 18 / .16);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 clamp(.95rem, .92rem + .15vw, 1rem)/1.55 "DM Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: Montserrat, "DM Sans", sans-serif; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 0; text-wrap: balance; }
p { text-wrap: pretty; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.muted { color: var(--muted); margin: 0; }

/* Controls */
.btn { height: 48px; padding: 0 22px; border: 0; border-radius: var(--r-md); font-weight: 700; cursor: pointer; }
.btn.primary { width: 100%; background: var(--orange); color: var(--ink); box-shadow: inset 0 -3px 0 rgb(0 0 0 / .15); }
.btn.primary:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: 0; padding: 0; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
label { display: block; font-weight: 500; margin-bottom: 16px; }
input { display: block; width: 100%; height: 48px; margin-top: 6px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: #fff; }
input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px color-mix(in srgb, var(--orange) 30%, transparent); }
.chip { display: inline-block; align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .8rem; font-weight: 700; }

/* Login: white brand panel inset in a dark frame */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; padding: 16px; background: var(--ink); }
.login-brand { background: #fff; border-radius: 28px; display: grid; place-items: center; padding: 48px; }
.login-brand img { width: min(520px, 100%); height: auto; }
.login-panel { display: grid; place-items: center; padding: 32px 24px; color: #fff; }
.login-card { width: min(400px, 100%); }
.login-card h1 { font-size: clamp(2rem, 1.6rem + 1.4vw, 2.6rem); }
.login-panel .muted { color: #c4c4be; margin: 12px 0 28px; }
.login-panel label { color: #e8e8e3; }
.login-panel input { background: rgb(255 255 255 / .07); border-color: rgb(255 255 255 / .2); color: #fff; }
.login-panel .link { display: block; margin: 20px auto 0; color: #fff; }
.pw { position: relative; display: block; }
.pw input { padding-right: 72px; }
.eye { position: absolute; right: 8px; bottom: 0; height: 48px; padding: 0 10px; background: none; border: 0; font-weight: 500; color: #c4c4be; cursor: pointer; }
.note { border-left: 5px solid var(--orange); border-radius: 0 10px 10px 0; background: rgb(255 255 255 / .08); padding: 10px 14px; margin: 0 0 22px; overflow-wrap: anywhere; }

/* App shell: floating sidebar */
.shell { display: grid; grid-template-columns: 264px 1fr; gap: 8px; padding: 16px; min-height: 100vh; }
.side { position: sticky; top: 16px; height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--card); border-radius: var(--r-lg); padding: 24px 14px 14px; box-shadow: var(--shadow); }
.side-logo { width: 168px; height: auto; margin: 0 10px 28px; }
.side nav { display: grid; gap: 4px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--bg); }
.side nav a.on { background: var(--ink); color: #fff; }
.side nav a.on svg { stroke: var(--orange); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.me { margin-top: auto; display: grid; grid-template-columns: auto 1fr; gap: 0 12px; align-items: center; padding: 14px; border-radius: var(--r-md); background: var(--bg); }
.avatar { grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font: 700 .85rem Montserrat, sans-serif; }
.me strong { line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--muted); }
.me .link { grid-column: 1 / -1; justify-self: start; margin-top: 10px; }
.main { padding: 24px 28px 56px; max-width: 1080px; width: 100%; }
.head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.head h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); text-transform: uppercase; letter-spacing: .01em; }
.bar { display: block; width: 56px; height: 18px; background: var(--orange); transform-origin: left; animation: grow .6s ease-out; }
@keyframes grow { from { transform: scaleX(0); } }

/* Dashboard: bento grid */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.tile { grid-column: span 3; display: flex; flex-direction: column; gap: 14px; min-height: 176px; padding: 22px; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.tile.wide { grid-column: span 2; }
.tile.hero { grid-column: span 4; justify-content: space-between; min-height: 224px; background: var(--ink); color: #fff; }
.tile.hero h2 { font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.3rem); }
.tile.hero p { margin: 10px 0 0; max-width: 40ch; color: #cfcfc8; }
.tile.hero .chip { background: var(--orange); color: var(--ink); }
.tile h2 { font-size: 1.05rem; letter-spacing: -.01em; }
.tile p { margin: 4px 0 0; color: var(--muted); }
.tile > .chip { margin-top: auto; }
.ico { width: 46px; height: 46px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--orange-soft); }
.ico svg { width: 22px; height: 22px; stroke: var(--ink); }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); }

.boot { max-width: 520px; margin: 18vh auto 0; padding: 0 24px; color: var(--muted); }
.boot.fail { border-left: 6px solid var(--orange); background: #fff; padding: 20px 24px; color: var(--ink); }
.boot h1 { font-size: 22px; margin-bottom: 10px; }

@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .tile, .tile.wide { grid-column: span 1; }
  .tile.hero { grid-column: span 2; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; padding: 12px; }
  .login-brand { padding: 32px 20px; border-radius: 22px; }
  .shell { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 16px; border-radius: 0; background: color-mix(in srgb, var(--card) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); }
  .side-logo { width: 120px; margin: 0; }
  .side nav { order: 3; width: 100%; display: flex; }
  .me { margin: 0 0 0 auto; padding: 0; background: none; grid-template-columns: auto; }
  .me .avatar, .me strong, .me small { display: none; }
  .me .link { margin: 0; }
  .main { padding: 20px 16px 48px; }
}
@media (max-width: 560px) {
  .bento { grid-template-columns: 1fr; }
  .tile.hero { grid-column: span 1; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
