:root {
  --bg: #f5f7fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --ink: #132238;
  --muted: #718096;
  --line: #e7ecf3;
  --primary: #2d6cdf;
  --primary-dark: #1f55bd;
  --primary-soft: #eaf1ff;
  --violet: #7557d7;
  --green: #198754;
  --green-soft: #eaf8f0;
  --amber: #c27a0b;
  --amber-soft: #fff5df;
  --red: #c2414a;
  --red-soft: #fff0f1;
  --shadow: 0 24px 70px rgba(22, 39, 71, 0.10);
  --shadow-soft: 0 10px 34px rgba(22, 39, 71, 0.07);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.eyebrow {
  margin: 0 0 10px;
  color: #6b7a90;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}

/* ---------- Login ---------- */
.auth-page {
  display: grid;
  place-items: center;
  padding: 28px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 10%, rgba(73, 111, 255, .22), transparent 30%),
    radial-gradient(circle at 86% 84%, rgba(71, 199, 167, .18), transparent 30%),
    #0d1728;
}

.auth-shell {
  width: min(1120px, 100%);
  min-height: 680px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 32px;
  box-shadow: 0 40px 110px rgba(0, 0, 0, .34);
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(20px);
}

.auth-brand {
  position: relative;
  padding: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: white;
  background:
    linear-gradient(145deg, rgba(33, 74, 152, .95), rgba(18, 36, 69, .96)),
    #193a77;
}

.auth-brand::after {
  content: "";
  position: absolute;
  inset: auto -140px -160px auto;
  width: 390px;
  height: 390px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.018);
}

.auth-brand .eyebrow { color: #9fc0ff; margin-top: 34px; }
.auth-brand h1 { margin: 0; font-size: clamp(42px, 5vw, 64px); line-height: 1.02; letter-spacing: -.045em; }
.auth-copy { max-width: 500px; margin: 24px 0 34px; color: #cbd9f2; font-size: 17px; line-height: 1.7; }

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: 13px;
  background: linear-gradient(145deg, #3f7cf0, #245fcf);
  box-shadow: 0 8px 20px rgba(45,108,223,.25);
}
.brand-mark span { border-radius: 4px; background: white; opacity: .95; }
.brand-mark span:nth-child(1) { height: 62%; align-self: end; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 78%; align-self: end; }
.brand-mark-large { width: 54px; height: 54px; padding: 10px; border-radius: 16px; }

.auth-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 520px; }
.auth-feature { padding: 16px; border: 1px solid rgba(255,255,255,.10); border-radius: 14px; background: rgba(255,255,255,.055); }
.auth-feature strong, .auth-feature span { display: block; }
.auth-feature strong { font-size: 14px; margin-bottom: 5px; }
.auth-feature span { color: #aebfda; font-size: 12px; }

.login-card {
  padding: 72px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
}
.login-card-heading h2 { margin: 0 0 10px; font-size: 34px; letter-spacing: -.035em; }
.login-card-heading > p:last-child { margin: 0 0 34px; color: var(--muted); line-height: 1.6; }
.mobile-brand { display: none; margin-bottom: 24px; }
.login-form { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 13px; font-weight: 700; color: #44536a; }
.field input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 1px solid #dfe5ee;
  border-radius: 13px;
  outline: none;
  color: var(--ink);
  background: #fbfcfe;
  transition: .2s ease;
}
.field input:focus { border-color: #75a0ef; box-shadow: 0 0 0 4px rgba(45,108,223,.10); background: #fff; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 68px; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 800; cursor: pointer; padding: 8px; }
.login-footnote { margin: 26px 0 0; text-align: center; color: #9aa5b4; font-size: 12px; }
.alert { display: flex; gap: 10px; align-items: center; margin: -10px 0 22px; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.alert-error { color: #a9333b; background: var(--red-soft); border: 1px solid #ffd9dd; }
.alert-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #d64b55; }

/* ---------- Shared buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { color: white; background: linear-gradient(135deg, #3778ef, #265fcf); box-shadow: 0 13px 28px rgba(45,108,223,.25); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 17px 34px rgba(45,108,223,.32); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; opacity: .75; }
.btn-full { width: 100%; margin-top: 4px; }

/* ---------- Dashboard ---------- */
.dashboard-page { position: relative; overflow-x: hidden; background: linear-gradient(180deg, #f8faff 0%, #f4f6fa 38%, #f6f7fa 100%); }
.page-glow { position: fixed; z-index: -1; width: 520px; height: 520px; border-radius: 50%; filter: blur(1px); pointer-events: none; }
.page-glow-one { top: -260px; right: -120px; background: radial-gradient(circle, rgba(81,129,255,.12), transparent 68%); }
.page-glow-two { bottom: -300px; left: -180px; background: radial-gradient(circle, rgba(65,190,160,.10), transparent 68%); }

.topbar {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > div:last-child { display: grid; }
.brand strong { font-size: 15px; line-height: 1.05; letter-spacing: -.01em; }
.brand > div:last-child span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 6px 10px 6px 7px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.8); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: white; font-weight: 800; background: linear-gradient(135deg, #2d6cdf, #6d58d8); }
.user-chip > div:last-child { display: grid; }
.user-chip span { color: #8a96a7; font-size: 10px; }
.user-chip strong { font-size: 12px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 13px; color: #64738a; background: rgba(255,255,255,.8); cursor: pointer; transition: .18s ease; }
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { color: var(--primary); border-color: #cfdbef; background: #fff; transform: translateY(-1px); }

.dashboard-shell { width: min(1220px, calc(100% - 40px)); margin: 14px auto 60px; }
.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr .75fr;
  gap: 36px;
  min-height: 360px;
  padding: 52px 54px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: var(--radius-xl);
  color: white;
  background:
    radial-gradient(circle at 80% 20%, rgba(94,151,255,.32), transparent 34%),
    linear-gradient(135deg, #12294e 0%, #183b72 56%, #1d4c91 100%);
  box-shadow: 0 30px 75px rgba(28, 59, 111, .18);
}
.hero-card::after { content: ""; position: absolute; right: -110px; bottom: -160px; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); box-shadow: 0 0 0 55px rgba(255,255,255,.025), 0 0 0 110px rgba(255,255,255,.018); }
.hero-copy { position: relative; z-index: 2; align-self: center; }
.hero-copy .eyebrow { color: #91b8ff; }
.hero-copy h1 { margin: 0; font-size: clamp(38px, 4.6vw, 62px); line-height: .98; letter-spacing: -.048em; }
.hero-copy h1 span { color: #9fc2ff; }
.hero-copy > p:not(.eyebrow) { max-width: 650px; margin: 22px 0 30px; color: #c6d5ec; font-size: 16px; line-height: 1.65; }
.hero-actions { display: flex; align-items: center; gap: 18px; }
.btn-update { min-width: 180px; height: 54px; background: white; color: #1d4f9e; box-shadow: 0 15px 35px rgba(0,0,0,.16); }
.btn-update:hover:not(:disabled) { box-shadow: 0 18px 40px rgba(0,0,0,.20); }
.btn-update.is-running .btn-icon { animation: spin 1s linear infinite; }
.btn-icon { display: grid; place-items: center; }
.hero-hint { max-width: 280px; color: #aebfda; font-size: 12px; line-height: 1.45; }

.status-panel { position: relative; z-index: 2; align-self: stretch; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; background: rgba(255,255,255,.075); backdrop-filter: blur(14px); }
.status-panel-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #b9c9e0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.status-badge { display: inline-flex; gap: 7px; align-items: center; padding: 7px 10px; border-radius: 999px; text-transform: none; letter-spacing: 0; font-size: 11px; font-weight: 800; }
.status-badge i, .history-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 16%, transparent); }
.status-idle { color: #d8e5fa; background: rgba(255,255,255,.08); }
.status-running { color: #a9c9ff; background: rgba(90,143,255,.14); }
.status-success { color: #8fe1bd; background: rgba(54,185,128,.14); }
.status-warning { color: #ffd183; background: rgba(224,156,47,.14); }
.status-error { color: #ff9da5; background: rgba(222,77,89,.14); }
.status-visual { flex: 1; display: grid; place-items: center; min-height: 170px; }
.status-orb { position: relative; width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; color: #d9e7ff; background: linear-gradient(145deg, rgba(111,162,255,.32), rgba(68,110,195,.14)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), 0 16px 50px rgba(0,0,0,.14); }
.status-orb svg { width: 34px; height: 34px; }
.orb-ring { position: absolute; inset: -14px; border: 1px solid rgba(174,205,255,.17); border-radius: 50%; }
.orb-ring-two { inset: -28px; border-color: rgba(174,205,255,.08); }
.orb-running svg { animation: spin 1.1s linear infinite; }
.orb-success { color: #a9f0d1; background: rgba(43,173,113,.16); }
.orb-warning { color: #ffe0a8; background: rgba(202,136,34,.16); }
.orb-error { color: #ffb4ba; background: rgba(208,64,76,.16); }
.status-message { display: grid; gap: 5px; }
.status-message strong { font-size: 15px; }
.status-message span { color: #aebfd8; font-size: 12px; line-height: 1.45; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 18px 0; }
.metric-card { min-height: 126px; padding: 22px; display: flex; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.88); box-shadow: var(--shadow-soft); }
.metric-icon { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; }
.metric-icon svg { width: 21px; height: 21px; }
.metric-blue { color: #2d6cdf; background: #edf3ff; }
.metric-violet { color: #7056cf; background: #f1edff; }
.metric-amber { color: #bd7612; background: #fff4df; }
.metric-green { color: #158657; background: #eaf8f1; }
.metric-card > div:last-child { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: baseline; }
.metric-card span { grid-column: 1 / -1; color: #7b8799; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.metric-card strong { margin-top: 6px; font-size: 29px; letter-spacing: -.04em; }
.metric-card small { color: #9aa5b4; font-size: 11px; }
.metric-card .metric-time { font-size: 20px; }

.content-grid { display: grid; grid-template-columns: 1.45fr .75fr; gap: 18px; margin-bottom: 18px; }
.section-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.90); box-shadow: var(--shadow-soft); }
.drive-card, .activity-card { padding: 26px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.section-caption { color: #929eae; font-size: 11px; white-space: nowrap; }
.drive-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.drive-link { min-height: 92px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 17px; border: 1px solid #e6ebf3; border-radius: 16px; text-decoration: none; background: #fbfcfe; transition: .18s ease; }
.drive-link:hover { transform: translateY(-2px); border-color: #ccd9ef; background: #fff; box-shadow: 0 12px 28px rgba(28,56,102,.08); }
.drive-disabled { opacity: .62; pointer-events: none; }
.drive-logo { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #3c72d3; font-weight: 800; background: #eef4ff; }
.drive-logo svg { width: 22px; height: 22px; }
.drive-link > span:nth-child(2) { display: grid; gap: 4px; }
.drive-link strong { font-size: 13px; }
.drive-link small { color: #8d99aa; font-size: 11px; }
.arrow-icon { width: 18px; height: 18px; color: #9ca8b8; }
.detail-list { margin: 0; }
.detail-list > div { display: flex; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid #edf0f4; }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: #8a96a7; font-size: 12px; }
.detail-list dd { margin: 0; font-size: 12px; font-weight: 800; text-align: right; }

.history-card { overflow: hidden; }
.history-heading { padding: 25px 26px 0; }
.history-table-wrap { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.history-table th { padding: 12px 26px; text-align: left; color: #8a96a7; background: #fafbfd; border-top: 1px solid #edf0f4; border-bottom: 1px solid #edf0f4; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.history-table td { padding: 15px 26px; border-bottom: 1px solid #eff2f6; color: #5f6e82; }
.history-table tbody tr:last-child td { border-bottom: 0; }
.history-table td strong { color: var(--ink); }
.history-status { display: inline-flex; gap: 7px; align-items: center; padding: 6px 9px; border-radius: 999px; font-weight: 800; font-size: 10px; }
.history-idle { color: #63758e; background: #f0f3f7; }
.history-running { color: #2c66cc; background: #eaf1ff; }
.history-success { color: #13774b; background: #e8f8ef; }
.history-warning { color: #a05e05; background: #fff3dc; }
.history-error { color: #b63a44; background: #ffedef; }
.empty-state { text-align: center; padding: 36px !important; color: #9aa5b4 !important; }

.toast { position: fixed; z-index: 100; right: 28px; bottom: 28px; max-width: min(390px, calc(100vw - 40px)); padding: 14px 17px; border: 1px solid #dfe6ef; border-radius: 14px; color: #34445b; background: white; box-shadow: 0 18px 50px rgba(25,43,77,.18); opacity: 0; transform: translateY(14px); pointer-events: none; transition: .22s ease; font-size: 13px; font-weight: 700; }
.toast-show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: #c9ecd9; color: #16734a; }
.toast-warning { border-color: #f0dab4; color: #925b0b; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; max-width: 560px; }
  .auth-brand { display: none; }
  .mobile-brand { display: grid; }
  .login-card { min-height: 620px; }
  .hero-card { grid-template-columns: 1fr; }
  .status-panel { min-height: 280px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .auth-page { padding: 14px; }
  .auth-shell { min-height: calc(100vh - 28px); border-radius: 24px; }
  .login-card { padding: 40px 26px; }
  .topbar, .dashboard-shell { width: min(100% - 24px, 1220px); }
  .topbar { min-height: 74px; }
  .user-chip > div:last-child { display: none; }
  .hero-card { padding: 34px 25px; border-radius: 22px; }
  .hero-copy h1 { font-size: 40px; }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .btn-update { width: 100%; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 108px; }
  .drive-list { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; gap: 6px; }
  .history-table th, .history-table td { padding-left: 18px; padding-right: 18px; }
}
