:root {
  color-scheme: dark;
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  color: #eef0f2;
  background: #101214;
  font-synthesis: none;
  --bg: #101214;
  --sidebar: #15171a;
  --surface: #191c20;
  --surface-raised: #1d2025;
  --border: #2a2e34;
  --border-strong: #373c44;
  --muted: #949ba6;
  --muted-dark: #6e747d;
  --text: #eef0f2;
  --accent: #5b7cfa;
  --accent-hover: #6d8afa;
  --success: #55bf8a;
  --danger: #e0717d;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); font-family: "Segoe UI", Inter, system-ui, sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.wordmark { display: flex; align-items: center; gap: 12px; }
.wordmark strong { font-size: .96rem; letter-spacing: -.01em; }
.logo { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; color: white; background: var(--accent); font-size: 1rem; font-weight: 750; }
.logo.small { width: 34px; height: 34px; border-radius: 9px; font-size: .84rem; }
.kicker { margin: 0 0 8px; color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: "Segoe UI", Arial, sans-serif; }
h1 { margin-bottom: 0; font-size: clamp(1.85rem, 4vw, 2.55rem); line-height: 1.1; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 1.08rem; letter-spacing: -.02em; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; padding: 0 16px; color: var(--text); background: transparent; font-weight: 650; transition: background .15s, border-color .15s, opacity .15s; }
.button:disabled { cursor: wait; opacity: .5; }
.button.primary { background: var(--accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.button.secondary { border-color: var(--border); background: #1a1d21; }
.button.secondary:hover { border-color: var(--border-strong); background: #202329; }
.button.tertiary { min-height: 36px; border-color: var(--border); color: #c7cbd1; background: transparent; }
.button.tertiary:hover { background: #22262b; }
.button.compact { padding: 0 12px; font-size: .78rem; }
.button.wide { width: 100%; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; background: #121416; }
.login-panel { width: min(100%, 410px); padding: 38px; border: 1px solid var(--border); border-radius: 14px; background: #181a1e; box-shadow: 0 18px 50px rgba(0,0,0,.24); }
.login-copy { margin: 40px 0 30px; }
.login-copy h1 { margin-bottom: 11px; font-size: 2rem; }
.login-copy > p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.login-form { display: grid; gap: 10px; }
.login-form label { margin-top: 8px; color: #c8ccd2; font-size: .82rem; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; outline: none; color: var(--text); background: #111316; transition: border-color .15s, box-shadow .15s; }
input { height: 46px; padding: 0 13px; }
textarea { min-height: 210px; padding: 14px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,124,250,.14); }
.login-form .button { margin-top: 16px; }
.session-note { margin: 20px 0 0; color: var(--muted-dark); font-size: .72rem; text-align: center; }
.notice { margin: 0; color: var(--success); font-size: .8rem; }
.notice.error { color: #f08b96; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; width: 230px; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--sidebar); }
.sidebar-brand { height: 86px; padding: 0 24px; border-bottom: 1px solid var(--border); }
.nav { display: grid; gap: 5px; padding: 20px 14px; }
.nav-button { display: flex; min-height: 44px; align-items: center; gap: 12px; border: 0; border-radius: 8px; padding: 0 12px; color: #a8aeb8; background: transparent; font-size: .86rem; text-align: left; }
.nav-button > span { display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid #3a3f47; border-radius: 6px; color: #aeb4bd; font-size: .7rem; font-weight: 750; }
.nav-button:hover { color: var(--text); background: #1d2024; }
.nav-button.active { color: #fff; background: #242933; }
.nav-button.active > span { border-color: var(--accent); color: white; background: var(--accent); }
.sidebar-footer { margin-top: auto; display: grid; gap: 16px; padding: 18px 16px; border-top: 1px solid var(--border); }
.server-state { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.server-state > i, .status-card strong i, .online-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--success); }
.server-state span { display: grid; gap: 2px; }
.server-state strong { font-size: .76rem; font-weight: 650; }
.server-state small { color: var(--muted-dark); font-size: .68rem; }

.workspace { min-height: 100vh; margin-left: 230px; padding: 46px clamp(28px,5vw,70px) 70px; }
.view { width: min(1120px, 100%); margin: 0 auto; }
.page-header { min-height: 80px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-description { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.date { margin: 10px 0 0; color: var(--muted); font-size: .8rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 14px; }
.stat-card { min-height: 155px; display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.stat-label { color: var(--muted); font-size: .78rem; }
.stat-card > strong { margin: auto 0 2px; font-size: 2rem; font-weight: 650; letter-spacing: -.04em; }
.stat-card > small { color: var(--muted-dark); font-size: .72rem; }
.status-card > strong { display: flex; align-items: center; gap: 9px; font-size: 1.18rem; letter-spacing: -.01em; }

.panel { border: 1px solid var(--border); border-radius: 11px; padding: 24px; background: var(--surface); }
.quick-panel { margin-bottom: 14px; }
.panel-heading { min-height: 38px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-heading p { margin: 5px 0 0; color: var(--muted-dark); font-size: .74rem; }
.counter { color: var(--muted-dark); font-size: .72rem; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-action { min-height: 86px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; border: 1px solid var(--border); border-radius: 9px; padding: 15px; color: var(--text); background: #17191d; text-align: left; }
.quick-action:hover { border-color: var(--border-strong); background: #1c1f23; }
.quick-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 8px; color: #dce3ff; background: #28324f; font-size: .78rem; font-weight: 750; }
.quick-action > span:nth-child(2) { display: grid; gap: 4px; }
.quick-action strong { font-size: .85rem; }
.quick-action small { color: var(--muted); font-size: .72rem; }
.quick-action b { color: var(--muted-dark); font-weight: 400; }
.recent-panel { min-height: 240px; }

.two-column { display: grid; grid-template-columns: minmax(320px,.78fr) minmax(380px,1.22fr); gap: 14px; align-items: start; }
.compose-panel, .upload-panel, .list-panel { min-height: 360px; }
.form-footer { min-height: 62px; display: flex; align-items: end; justify-content: space-between; gap: 14px; padding-top: 14px; }
.form-footer .button { margin-left: auto; }
.drop-zone { min-height: 210px; display: grid; place-content: center; justify-items: center; border: 1px dashed #454b55; border-radius: 9px; color: var(--muted); background: #15171a; text-align: center; transition: border-color .15s, background .15s; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: #191d27; }
.drop-zone .upload-icon { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 13px; border: 1px solid var(--border-strong); border-radius: 9px; color: #b8c5f7; background: #1d222f; font-size: 1.2rem; }
.drop-zone strong { max-width: 260px; overflow: hidden; color: #d8dbe0; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.drop-zone small { margin-top: 4px; color: var(--muted-dark); font-size: .72rem; }

.item-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.list-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 68px; padding: 11px; border: 1px solid var(--border); border-radius: 8px; background: #17191d; }
.item-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 7px; color: #c8d2fb; background: #252b3a; font-size: .7rem; font-weight: 750; }
.item-body { min-width: 0; }
.item-body strong, .item-body p { display: block; margin: 0; overflow: hidden; color: #d9dce1; font-size: .8rem; font-weight: 600; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.item-body p { font-weight: 400; }
.item-body small { display: block; margin-top: 4px; color: var(--muted-dark); font-size: .68rem; }
.item-action { min-width: 34px; min-height: 34px; border: 1px solid var(--border); border-radius: 7px; color: #bbc1ca; background: transparent; font-size: .72rem; }
.item-action:hover { border-color: var(--border-strong); background: #22262b; }
.item-action.copy-action { min-width: 88px; padding: 0 11px; border-color: #3d4e80; color: #dce3ff; background: #222a40; font-weight: 650; }
.item-action.copy-action:hover { border-color: #5873c7; background: #293553; }
.item-action.copy-action.success { border-color: #3a7c5d; color: #c9f5df; background: #1d3a2d; }
.item-actions { display: flex; align-items: center; gap: 7px; }
.favorite-action { color: #aeb4bd; font-size: 1rem; }
.favorite-action.active { border-color: #75632f; color: #f0cf67; background: #302a19; }
.pc-action { min-width: 96px; padding-inline: 10px; color: #dce3ff; border-color: #3d4e80; background: #222a40; }
.remote-panel { max-width: 860px; }
.remote-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 18px; }
.remote-action { min-height: 135px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 5px; border: 1px solid var(--border); border-radius: 10px; padding: 18px; color: var(--text); background: #17191d; text-align: left; }
.remote-action:hover { border-color: #526ba9; background: #1d222d; }
.remote-action:disabled { opacity: .55; cursor: wait; }
.remote-action > span { display: grid; width: 37px; height: 37px; place-items: center; margin-bottom: auto; border-radius: 9px; color: #dce3ff; background: #28324f; font-weight: 750; }
.remote-action strong { font-size: .86rem; }
.remote-action small { color: var(--muted); font-size: .7rem; }
.empty { min-height: 230px; display: grid; place-content: center; justify-items: center; color: var(--muted-dark); text-align: center; }
.empty > span { display: grid; width: 38px; height: 38px; place-items: center; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: .72rem; font-weight: 750; }
.empty strong { margin-bottom: 4px; color: #b8bdc5; font-size: .82rem; }
.empty p { margin: 0; font-size: .72rem; }
.activity-list { display: grid; gap: 1px; }
.activity-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 51px; border-top: 1px solid var(--border); }
.activity-row.has-action { grid-template-columns: auto minmax(0,1fr) auto auto; }
.activity-row:first-child { border-top: 0; }
.activity-row .item-icon { width: 30px; height: 30px; }
.activity-row strong { overflow: hidden; font-size: .78rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.activity-row time { color: var(--muted-dark); font-size: .68rem; }
.activity-row .compact-copy { min-height: 30px; }
.activity-empty { padding: 45px 0; color: var(--muted-dark); font-size: .78rem; text-align: center; }
.mobile-header, .mobile-nav { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .sidebar { width: 205px; }
  .workspace { margin-left: 205px; padding-inline: 24px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .status-card { grid-column: 1 / -1; min-height: 105px; }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .workspace { margin-left: 0; padding: 0 14px 28px; }
  .mobile-header { height: 68px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
  .online-dot { margin-right: 5px; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 10; display: grid; grid-template-columns: repeat(4,1fr); min-height: calc(64px + env(safe-area-inset-bottom)); padding: 6px 7px env(safe-area-inset-bottom); border-top: 1px solid var(--border); background: rgba(21,23,26,.97); }
  .mobile-nav .nav-button { min-height: 52px; display: grid; justify-items: center; gap: 3px; padding: 3px; border-radius: 7px; font-size: .64rem; }
  .mobile-nav .nav-button > span { width: 22px; height: 22px; }
  .page-header { min-height: auto; margin: 26px 2px 22px; }
  .date { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 125px; padding: 17px; }
  .stat-card > strong { font-size: 1.65rem; }
  .status-card { grid-column: 1 / -1; min-height: 90px; }
  .quick-actions { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .activity-row.has-action { grid-template-columns: auto minmax(0,1fr) auto; padding: 7px 0; }
  .activity-row.has-action time { display: none; }
  .activity-row .compact-copy { min-width: 78px; padding-inline: 8px; }
  .login-panel { padding: 28px 24px; }
  .login-copy { margin: 32px 0 24px; }
  .remote-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .list-item { grid-template-columns: auto minmax(0,1fr); }
  .list-item .item-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 390px) {
  .stat-grid { grid-template-columns: 1fr; }
  .status-card { grid-column: auto; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .button { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
