:root {
  font-family: Lexend, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1e2227;
  background: #f7f5ef;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f7f5ef; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(188, 143, 45, .48); outline-offset: 2px; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 1.15fr) minmax(340px, .85fr); background: #f7f5ef; }
.login-brand { position: relative; overflow: hidden; padding: clamp(2rem, 6vw, 6rem); color: #fff; background: linear-gradient(145deg, #151311 0%, #2c2219 47%, #0d0d0e 100%); display: flex; align-items: flex-end; }
.login-brand::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 100% 0, rgba(196,151,56,.56), transparent 28%), radial-gradient(circle at 14% 100%, rgba(255,255,255,.10), transparent 34%), linear-gradient(120deg, transparent 44%, rgba(203,163,75,.17) 44.2%, transparent 45%); }
.login-brand > * { position: relative; }
.login-brand img { max-width: 260px; max-height: 90px; object-fit: contain; object-position: left; filter: drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
.login-brand h1 { margin: 1.5rem 0 .5rem; font-size: clamp(2rem, 4vw, 3.6rem); letter-spacing: -.06em; }
.login-brand p { max-width: 32rem; margin: 0; color: rgba(255,255,255,.74); line-height: 1.65; }
.login-brand .login-network-visual { position: absolute; z-index: 0; width: min(72vw, 820px); max-width: none; max-height: none; height: auto; right: -14%; top: -11%; opacity: .82; object-fit: contain; object-position: center; filter: none; }
.login-brand::before { z-index: 1; background: linear-gradient(90deg, rgba(10,10,12,.88) 0%, rgba(10,10,12,.43) 50%, rgba(10,10,12,.16) 100%); }
.login-brand .login-brand-copy { position: relative; z-index: 2; }
.login-brand .login-suite-mark { max-width: 220px; max-height: 68px; filter: brightness(0) invert(1) drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { width: min(100%, 430px); }
.eyebrow { color: #92702a; font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.login-card h2 { margin: .5rem 0 1rem; font-size: 1.8rem; letter-spacing: -.04em; }
.login-card p { color: #65605a; line-height: 1.55; }
.mt-1 { margin-top: 1rem; }
.mt-125 { margin-top: 1.25rem; }
.field-action { align-items: start; justify-content: end; }
.minute-field { display: flex; grid-template-columns: auto 86px; align-items: center; gap: .45rem; }
.instruction-choice { display: block; margin: .3rem 0; }
.accept-button { margin-top: .6rem; }
.work-block { display: block; }
.work-message-form { display: flex; gap: .5rem; }
.test-chip.test-chip-dark { color: #674b00; background: #fff0b8; border-color: #ead28b; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 276px minmax(0, 1fr); --accent: #b3882f; --deep: #171513; --soft: #f7f5ef; --accent-soft: #f0e2bd; }
.shell[data-app="plandero"] { --accent: #1877bd; --deep: #102842; --soft: #f5f9fd; --accent-soft: #d6edff; }
.shell[data-app="teamo"] { --accent: #dc826a; --deep: #201817; --soft: #fdf8f5; --accent-soft: #ffe0d8; }
.shell[data-app="zelari"] { --accent: #09826d; --deep: #0d2c29; --soft: #f5fbf8; --accent-soft: #d7f2e8; }
.shell[data-app="dokusafe"] { --accent: #f0d922; --deep: #102049; --soft: #f7f9ff; --accent-soft: #fff9bc; }
.shell[data-app="q-bilanta"] { --accent: #b3882f; --deep: #171513; --soft: #f8f5ed; --accent-soft: #f0e2bd; }
.shell[data-app="max-cloud"] { --accent: #fafafa; --deep: #090909; --soft: #f7f7f7; --accent-soft: #e8e8e8; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem; padding: 1.15rem; color: #fff; background: var(--deep); overflow-y: auto; }
.sidebar::before { content: ""; position: fixed; z-index: 0; width: 276px; height: 100vh; top: 0; left: 0; pointer-events: none; background: radial-gradient(ellipse at 100% 0, color-mix(in srgb, var(--accent) 38%, transparent), transparent 38%), linear-gradient(150deg, transparent 65%, color-mix(in srgb, var(--accent) 23%, transparent) 65.3%, transparent 66%); opacity: .85; }
.sidebar > * { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; min-height: 62px; padding: .4rem .35rem .8rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand img { max-width: 190px; max-height: 48px; width: auto; height: auto; object-fit: contain; object-position: left center; }
.brand.max-brand img { filter: brightness(0) invert(1); }
.nav { display: grid; gap: .28rem; }
.nav button { color: rgba(255,255,255,.75); background: transparent; border: 0; text-align: left; padding: .7rem .75rem; border-radius: 12px; font-weight: 650; transition: .16s ease; }
.nav button:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav button.is-active { color: var(--deep); background: var(--accent); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 27%, transparent); }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: .8rem; display: grid; gap: .7rem; }
.user-email { font-size: .74rem; color: rgba(255,255,255,.62); overflow-wrap: anywhere; }
.quiet-button { border: 1px solid rgba(255,255,255,.2); color: #fff; background: transparent; padding: .6rem .7rem; border-radius: 10px; }

.main { min-width: 0; background: var(--soft); }
.topbar { min-height: 74px; display: flex; align-items: center; gap: 1rem; padding: .95rem clamp(1rem, 3vw, 2.4rem); border-bottom: 1px solid rgba(24,27,32,.08); background: color-mix(in srgb, var(--soft) 88%, white); position: sticky; top: 0; z-index: 5; }
.mobile-brand { display: none; }
.title-block { min-width: 0; margin-right: auto; }
.title-block h1 { margin: 0; font-size: clamp(1.2rem, 2vw, 1.7rem); letter-spacing: -.04em; }
.title-block p { margin: .22rem 0 0; color: #6a6d71; font-size: .84rem; }
.tenant-select { max-width: 265px; color: #222; background: #fff; border: 1px solid rgba(25, 30, 35, .16); border-radius: 10px; padding: .6rem .7rem; }
.content { padding: clamp(1rem, 3vw, 2.25rem); max-width: 1500px; margin: 0 auto; }
.content-grid { display: grid; gap: 1rem; }
.hero { border-radius: 20px; padding: clamp(1.15rem, 3vw, 2rem); background: linear-gradient(120deg, color-mix(in srgb, var(--deep) 92%, #000), var(--deep)); color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 38%; aspect-ratio: 1; right: -9%; top: -50%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 78%, transparent), transparent 64%); }
.hero > * { position: relative; z-index: 1; }
.hero h2 { margin: .3rem 0 .5rem; font-size: clamp(1.4rem, 3vw, 2.1rem); letter-spacing: -.05em; }
.hero p { max-width: 46rem; margin: 0; color: rgba(255,255,255,.75); line-height: 1.5; }
.test-chip, .status, .tag { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .3rem .58rem; font-size: .75rem; font-weight: 800; }
.test-chip { color: #fff3cd; background: rgba(221, 169, 62, .25); border: 1px solid rgba(255,221,130,.32); }
.status { background: #edf0f2; color: #495057; }
.status.ready, .status.active, .status.accepted, .status.approved, .status.eligible { color: #08755e; background: #def7ed; }
.status.review, .status.submitted, .status.planned { color: #955b00; background: #fff0d1; }
.status.blocked, .status.rejected, .status.failed, .status.suspended { color: #a5292f; background: #ffe3e5; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.card { background: #fff; border: 1px solid rgba(28,32,38,.09); box-shadow: 0 14px 34px rgba(24, 29, 36, .05); border-radius: 16px; padding: 1rem; }
.metric { font-size: 2.05rem; font-weight: 850; letter-spacing: -.06em; color: var(--deep); }
.metric-label { color: #6b6f75; font-size: .8rem; margin-top: .15rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .85fr); gap: 1rem; align-items: start; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.panel-title h3 { margin: 0; font-size: 1rem; letter-spacing: -.025em; }
.panel-title p { margin: .2rem 0 0; color: #74777c; font-size: .82rem; }
.row-list { display: grid; gap: .65rem; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: .8rem; border: 1px solid rgba(27, 31, 36, .08); border-radius: 12px; background: #fcfcfd; }
.row-main { min-width: 0; }
.row-title { font-weight: 750; overflow-wrap: anywhere; }
.row-sub { color: #6f7378; font-size: .78rem; margin-top: .2rem; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.tenant-row { align-items: start; }
.tenant-url-list { display: grid; gap: .25rem; margin-top: .55rem; }
.tenant-url { color: #315b91; font-size: .76rem; overflow-wrap: anywhere; }
.button { border: 0; color: #fff; background: var(--deep); padding: .64rem .84rem; border-radius: 10px; font-weight: 760; box-shadow: 0 6px 12px rgba(0,0,0,.09); }
.button:hover { transform: translateY(-1px); }
.button.accent { color: var(--deep); background: var(--accent); }
.button.soft { color: var(--deep); background: var(--accent-soft); }
.button.danger { color: #fff; background: #a92b32; }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.form-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: .35rem; color: #565b61; font-size: .78rem; font-weight: 700; }
.field input, .field select { min-width: 0; color: #22272b; background: #fff; border: 1px solid rgba(28,32,38,.16); border-radius: 10px; padding: .66rem .7rem; }
.field.span-2 { grid-column: span 2; }
.hint { margin: .5rem 0 0; color: #6c7178; font-size: .78rem; line-height: 1.45; }
.empty { padding: 1.3rem; border: 1px dashed rgba(37,42,49,.22); border-radius: 13px; color: #73767b; text-align: center; background: rgba(255,255,255,.55); }
.message-list { display: grid; gap: .5rem; max-height: 280px; overflow-y: auto; margin-bottom: .7rem; }
.message { padding: .7rem; background: #f1f3f5; border-radius: 12px; border-bottom-left-radius: 3px; }
.message-meta { display: block; color: #70757b; font-size: .7rem; margin-bottom: .25rem; }
.audit { font-size: .78rem; }
.integration { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid rgba(30,35,41,.08); }
.integration:last-child { border-bottom: 0; }
.arrow { color: var(--accent); font-size: 1.1rem; }
.toast { position: fixed; z-index: 20; bottom: 1rem; left: 50%; transform: translate(-50%, 150%); min-width: min(92vw, 440px); padding: .8rem 1rem; color: #fff; background: #202327; border-radius: 11px; box-shadow: 0 14px 34px rgba(0,0,0,.24); opacity: 0; transition: .22s ease; text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: #9e2931; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 74px; }
  .sidebar { z-index: 10; position: fixed; top: auto; bottom: 0; left: 0; width: 100%; height: 74px; padding: .5rem .55rem; display: block; overflow: visible; background: var(--deep); }
  .sidebar::before, .brand, .sidebar-foot { display: none; }
  .nav { display: flex; gap: .25rem; height: 100%; overflow-x: auto; }
  .nav button { flex: 0 0 auto; padding: .52rem .64rem; font-size: .75rem; text-align: center; }
  .topbar { min-height: 70px; padding: .75rem 1rem; }
  .mobile-brand { display: block; width: 34px; height: 34px; object-fit: contain; }
  .title-block p { display: none; }
  .tenant-select { max-width: 170px; font-size: .78rem; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 230px; padding: 2rem; align-items: flex-end; }
  .login-brand .login-network-visual { width: 570px; right: -25%; top: -62%; opacity: .62; }
  .login-panel { padding: 1.25rem; align-items: flex-start; }
  .content { padding: 1rem; }
  .topbar { gap: .65rem; }
  .tenant-select { max-width: 128px; }
  .title-block h1 { font-size: 1.05rem; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .row { grid-template-columns: 1fr; gap: .65rem; }
  .row-actions { justify-content: flex-start; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-color-scheme: dark) {
  body:not(.force-light) { background: #15171b; }
  body:not(.force-light) .main { background: #171a1e; color: #edf0f2; }
  body:not(.force-light) .topbar { background: #1b1e23; border-color: rgba(255,255,255,.09); }
  body:not(.force-light) .title-block p, body:not(.force-light) .metric-label, body:not(.force-light) .row-sub, body:not(.force-light) .hint, body:not(.force-light) .panel-title p { color: #a8afb7; }
  body:not(.force-light) .card, body:not(.force-light) .row { background: #22262c; border-color: rgba(255,255,255,.09); }
  body:not(.force-light) .metric, body:not(.force-light) .field input, body:not(.force-light) .field select { color: #f6f8fa; }
  body:not(.force-light) .field input, body:not(.force-light) .field select, body:not(.force-light) .tenant-select { background: #20242a; border-color: rgba(255,255,255,.17); color: #f5f7f8; }
  body:not(.force-light) .message { background: #2d3239; }
  body:not(.force-light) .empty { background: #1b1f24; border-color: rgba(255,255,255,.17); color: #afb6be; }
}
