/* Astra-inspired blue / navy / white theme
   Matches the attached Sales & Marketing dashboard reference while preserving
   Meridian HR layouts, modules and functionality. */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --raised: #f8faff;
  --field: #ffffff;
  --hover: rgba(19, 103, 255, 0.055);
  --line: rgba(17, 35, 68, 0.09);
  --line-strong: rgba(17, 35, 68, 0.15);
  --text: #08152f;
  --text-2: #607194;
  --muted: #8190ad;
  --accent: #1167ff;
  --accent-strong: #0057ef;
  --accent-ink: #ffffff;
  --accent-soft: rgba(17, 103, 255, 0.10);
  --accent-line: rgba(17, 103, 255, 0.28);
  --ok: #168660;
  --ok-soft: rgba(22, 134, 96, 0.10);
  --warn: #a56a10;
  --warn-soft: rgba(165, 106, 16, 0.11);
  --danger: #cf3e35;
  --danger-soft: rgba(207, 62, 53, 0.10);
  --neutral-soft: rgba(17, 35, 68, 0.06);
  --shadow: 0 18px 44px -24px rgba(16, 43, 91, 0.24);
  --radius-s: 9px;
  --radius: 12px;
  --radius-l: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b13;
  --surface: #0d1421;
  --raised: #121c2d;
  --field: #09111d;
  --hover: rgba(87, 162, 255, 0.10);
  --line: rgba(168, 197, 239, 0.10);
  --line-strong: rgba(168, 197, 239, 0.18);
  --text: #edf5ff;
  --text-2: #aabbd4;
  --muted: #7186a6;
  --accent: #57a2ff;
  --accent-strong: #8bc0ff;
  --accent-ink: #06111f;
  --accent-soft: rgba(87, 162, 255, 0.14);
  --accent-line: rgba(87, 162, 255, 0.34);
  --ok: #55d4a2;
  --ok-soft: rgba(85, 212, 162, 0.14);
  --warn: #f0bd68;
  --warn-soft: rgba(240, 189, 104, 0.14);
  --danger: #ff8c80;
  --danger-soft: rgba(255, 140, 128, 0.14);
  --neutral-soft: rgba(168, 197, 239, 0.08);
  --shadow: 0 22px 54px -28px rgba(0, 0, 0, 0.8);
}

body {
  background:
    radial-gradient(circle at 85% -10%, rgba(17,103,255,.08), transparent 28rem),
    var(--bg);
}

.sidebar {
  background: linear-gradient(180deg, #07111f 0%, #081426 52%, #06101e 100%);
  border-right-color: rgba(143, 176, 224, .12);
  color: #f7fbff;
}

.brand {
  margin: -18px -12px 8px;
  padding: 24px 20px 22px;
  border-bottom: 1px solid rgba(143,176,224,.14);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #2782ff, #0662f6);
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 10px 24px -12px rgba(17,103,255,.9);
}

.brand strong { color: #ffffff; font-weight: 700; letter-spacing: .01em; }
.brand span { color: #57a2ff; font-weight: 600; }

.nav-group {
  color: #7f9dc8;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 10.5px;
}

.nav a {
  height: 42px;
  border-radius: 11px;
  color: #bfd0e9;
  font-weight: 570;
  padding: 0 12px;
}

.nav a .i { color: #8fb0da; }
.nav a:hover {
  background: rgba(255,255,255,.055);
  color: #ffffff;
}
.nav a:hover .i { color: #cfe1fa; }

.nav a.active {
  color: #ffffff;
  background: linear-gradient(135deg, #1770ff, #0b60ef);
  box-shadow: 0 12px 25px -16px rgba(17,103,255,.95);
}
.nav a.active .i { color: #ffffff; }

.sidebar .me {
  background: rgba(3, 12, 25, .48);
  border-color: rgba(143,176,224,.18);
}
.sidebar .me strong { color: #ffffff; }
.sidebar .me span { color: #83a4ce; }
.sidebar .avatar {
  background: #eff6ff;
  color: #1167ff;
  border-color: rgba(255,255,255,.18);
}
.sidebar .icon-btn { color: #8eb3df; }
.sidebar .icon-btn:hover {
  color: #fff;
  background: rgba(17,103,255,.16);
  border-color: rgba(72,142,255,.28);
}

.topbar {
  height: 68px;
  background: rgba(247, 249, 253, .92);
  border-bottom-color: rgba(17,35,68,.08);
  box-shadow: 0 4px 24px rgba(23, 48, 92, .035);
}

.search-trigger,
.btn,
.panel,
.metrics,
.tool,
.palette-box,
dialog,
.ai-panel {
  box-shadow: 0 10px 28px -24px rgba(19, 50, 105, .25);
}

.search-trigger {
  height: 42px;
  background: #fff;
  border-color: rgba(17,35,68,.10);
}

.icon-btn:hover,
.ask-btn:hover { color: #1167ff; }

.ask-btn {
  height: 42px;
  background: #ffffff;
  border-color: rgba(17,35,68,.11);
  color: #0b1831;
  font-weight: 650;
}

.btn {
  min-height: 40px;
  border-color: rgba(17,35,68,.12);
}
.btn-primary {
  background: linear-gradient(135deg, #1770ff, #0b60ef);
  border-color: #1167ff;
  box-shadow: 0 12px 22px -15px rgba(17,103,255,.8);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0d64f7, #0056e9);
}

.panel,
.metrics {
  border-color: rgba(17,35,68,.09);
  box-shadow: 0 14px 34px -28px rgba(17, 43, 90, .28);
}

.panel-head { border-bottom-color: rgba(17,35,68,.07); }
.panel-head h2,
.page-head h1,
.cell-title,
.empty strong { color: #08152f; }

.metric { padding-top: 19px; padding-bottom: 19px; }
.metric b { color: #071631; font-weight: 700; }
.metric span { color: #7585a4; }

input:not([type]),
input[type=text],
input[type=email],
input[type=password],
input[type=search],
input[type=tel],
input[type=url],
input[type=number],
input[type=date],
input[type=time],
select,
textarea {
  border-color: rgba(17,35,68,.13);
  box-shadow: inset 0 1px 0 rgba(17,35,68,.015);
}

/* Dashboard: make the main attention/renewal card feel like the dark hero in
   the supplied reference while keeping its existing HR content. */
.horizon {
  background:
    radial-gradient(circle at 90% 5%, rgba(26,112,255,.58), transparent 26%),
    radial-gradient(circle at 80% 95%, rgba(14,77,187,.22), transparent 34%),
    linear-gradient(105deg, #07111f 0%, #08182e 58%, #071426 100%);
  border-color: rgba(74, 137, 236, .16);
  box-shadow: 0 18px 42px -24px rgba(5, 29, 73, .55);
}
.horizon,
.horizon h2,
.horizon b { color: #ffffff; }
.horizon p,
.horizon span,
.horizon .muted { color: #9eb6d8 !important; }
.horizon .f-accent b { color: #4d9cff; }
.horizon .track::before {
  background: linear-gradient(90deg, rgba(255,255,255,.12), rgba(72,142,255,.55), rgba(255,255,255,.12));
}
.horizon .tick { background: #67a6ff; }

.link-more,
.tool-open { color: #1167ff; font-weight: 650; }

.badge.tone-accent { color: #0b60ef; }

.ai-orb {
  background: rgba(17,103,255,.10);
  color: #1167ff;
  border-color: rgba(17,103,255,.24);
}

.palette { background: rgba(5, 13, 28, .50); }

/* Auth/setup pages use the same clean light surface and blue identity. */
.bare {
  background:
    radial-gradient(circle at 50% -10%, rgba(17,103,255,.12), transparent 32rem),
    #f4f7fb;
}
.auth-brand .brand-mark { box-shadow: 0 16px 32px -18px rgba(17,103,255,.85); }
.setup-side {
  background: linear-gradient(180deg, #07111f, #0a1930);
  color: #fff;
  border-right-color: rgba(255,255,255,.1);
}
.setup-side .brand strong { color: #fff; }
.setup-side .brand span,
.setup-side .foot { color: #90acd2; }
.steps li { color: #8ba7cd; }
.steps li.on {
  color: #fff;
  background: rgba(17,103,255,.16);
}
.steps li.done { color: #c7d7ed; }

@media (max-width: 1024px) {
  .sidebar {
    width: min(300px, 86vw);
    height: 100dvh;
    max-height: 100dvh;
    box-shadow: 18px 0 48px -28px rgba(2,10,25,.8);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .brand {
    position: sticky;
    top: -18px;
    z-index: 2;
    background: linear-gradient(180deg, #07111f 0%, #081426 100%);
  }
  .nav a {
    height: 44px;
    gap: 12px;
  }
  .nav a .i {
    width: 20px;
    height: 20px;
    padding: 1px;
  }
  .sidebar-foot {
    position: sticky;
    bottom: 0;
    padding-bottom: 2px;
    background: linear-gradient(180deg, rgba(6,16,30,0), #06101e 24%);
  }
  .me {
    min-height: 56px;
  }
  .me .avatar {
    width: 36px;
    height: 36px;
    box-shadow: 0 8px 18px -12px rgba(17,103,255,.9);
  }
}


/* Renewal horizon visibility fixes */
.horizon .track {
  position: relative;
  min-height: 112px;
  color: #dbe8fb;
}
.horizon .track::before {
  z-index: 1;
  background: rgba(132, 170, 225, .28) !important;
}
.horizon .track-overdue {
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 24px;
  width: 12%;
  z-index: 0;
  background: rgba(207, 62, 53, .09) !important;
  border-right: 1px solid rgba(240, 108, 96, .22);
  border-radius: 12px 0 0 12px;
}
.horizon .track-window {
  position: absolute;
  left: 12%;
  top: 6px;
  bottom: 24px;
  z-index: 0;
  min-width: 1px;
  background: rgba(17, 103, 255, .10) !important;
  border: 1px solid rgba(64, 139, 255, .18);
  border-radius: 0 12px 12px 0;
}
.horizon .track-window::after {
  color: #57a2ff !important;
  font-weight: 600;
  opacity: 1;
}
.horizon .horizon-empty {
  position: absolute;
  left: 12%;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  padding: 8px 14px;
  text-align: center;
  color: #d7e5f8 !important;
  background: rgba(7, 20, 38, .68) !important;
  border: 1px solid rgba(112, 158, 224, .16);
  border-radius: 9px;
  backdrop-filter: blur(4px);
}
.horizon .tick {
  z-index: 4;
  color: #9eb6d8 !important;
  background: transparent !important;
  font-weight: 550;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.horizon .tick.first { color: #f08b80 !important; }
.horizon .blip {
  z-index: 5;
  box-shadow: 0 0 0 3px rgba(17,103,255,.18), 0 0 12px rgba(17,103,255,.45);
}
.horizon .blip.r-expired {
  box-shadow: 0 0 0 3px rgba(240,139,128,.16), 0 0 12px rgba(240,139,128,.40);
}

/* Dashboard attendance lead card */
.attendance-hero {
  padding: 22px;
  margin-bottom: 16px;
  overflow: hidden;
}
.attendance-hero-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.attendance-hero h2 { font-size: 20px; }
.attendance-hero p {
  color: var(--text-2);
  margin-top: 3px;
}
.attendance-hero-grid {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}
.attendance-ring {
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    radial-gradient(closest-side, var(--surface) 70%, transparent 72%),
    conic-gradient(var(--accent) calc(var(--p) * 1%), var(--neutral-soft) 0);
}
.attendance-ring b {
  font-size: 28px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.attendance-ring span {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}
.attendance-hero-body { min-width: 0; }
.att-legend-hero {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  margin-top: 16px;
}
.horizon-compact {
  padding: 18px 18px 20px;
  margin-bottom: 0;
}
.horizon-compact .horizon-head {
  gap: 12px;
  margin-bottom: 16px;
}
.horizon-compact .horizon-figures { gap: 14px; }
.horizon-compact .horizon-figures b { font-size: 20px; }
.horizon-compact .track {
  height: 94px;
  min-height: 94px;
}
.horizon-compact .track-window { top: 5px; bottom: 22px; }
.horizon-compact .track-overdue { top: 9px; bottom: 22px; }
.horizon-compact .tick:nth-of-type(4) { display: none; }

/* PWA install prompt and startup intro */
.pwa-prompt {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 82;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-l);
  box-shadow: 0 24px 54px -28px rgba(6, 25, 58, .45);
  padding: 16px;
}
.pwa-prompt-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.pwa-prompt .brand-mark {
  width: 38px;
  height: 38px;
  margin: 0;
  flex: none;
}
.pwa-prompt h2 { font-size: 15px; }
.pwa-prompt p {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 13px;
}
.pwa-prompt .icon-btn {
  width: 32px;
  height: 32px;
  margin-left: auto;
}
.pwa-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.app-intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(17,103,255,.14), transparent 18rem),
    #f4f7fb;
  animation: intro-out .28s ease .72s forwards;
}
.intro-card {
  display: grid;
  place-items: center;
  gap: 14px;
  color: #08152f;
  animation: intro-pop .52s cubic-bezier(.2,.8,.2,1);
}
.intro-card .brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}
.intro-card strong {
  font-size: 18px;
  letter-spacing: -.01em;
}
@keyframes intro-pop {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
}
@keyframes intro-out {
  to { opacity: 0; visibility: hidden; }
}
.progress-loader {
  position: fixed;
  inset: 0;
  z-index: 98;
  display: grid;
  place-items: center;
  background: rgba(244, 247, 251, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.progress-card {
  width: min(340px, calc(100vw - 36px));
  padding: 18px;
  border: 1px solid rgba(17,35,68,.10);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 22px 55px -30px rgba(7, 26, 60, .45);
}
.progress-card .brand-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
}
.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.progress-copy strong {
  color: var(--text);
  font-size: 14px;
}
.progress-copy span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 103, 255, .10);
}
.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1167ff, #57a2ff);
  transition: width .16s ease;
}

/* ---------- Prompts & Notes workspace ---------- */
.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  padding: 16px;
}
.workspace-card {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: 0 12px 28px -26px rgba(17, 43, 90, .32);
}
.workspace-card:hover { border-color: var(--accent-line); }
.workspace-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.workspace-card h3 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 10px;
}
.workspace-text {
  flex: 1;
  max-height: 280px;
  overflow: auto;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  padding-right: 4px;
}
.workspace-pinned {
  flex: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}
.workspace-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.workspace-actions form { margin: 0; }

/* Premium dark mode restores a true dark surface while preserving the blue identity. */
:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 84% -12%, rgba(87,162,255,.18), transparent 30rem),
    radial-gradient(circle at 18% 12%, rgba(12,70,160,.18), transparent 24rem),
    var(--bg);
}
:root[data-theme="dark"] .topbar {
  background: rgba(7, 11, 19, .86);
  border-bottom-color: var(--line);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
}
:root[data-theme="dark"] .search-trigger,
:root[data-theme="dark"] .ask-btn,
:root[data-theme="dark"] .btn,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .metrics,
:root[data-theme="dark"] .tool,
:root[data-theme="dark"] .palette-box,
:root[data-theme="dark"] dialog,
:root[data-theme="dark"] .ai-panel,
:root[data-theme="dark"] .pwa-prompt {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 18px 42px -30px rgba(0,0,0,.9);
}
:root[data-theme="dark"] .btn-quiet {
  background: transparent;
}
:root[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #57a2ff, #1b73f8);
  border-color: #57a2ff;
  color: #06111f;
  box-shadow: 0 14px 24px -16px rgba(87,162,255,.9);
}
:root[data-theme="dark"] .ask-btn,
:root[data-theme="dark"] .panel-head h2,
:root[data-theme="dark"] .page-head h1,
:root[data-theme="dark"] .cell-title,
:root[data-theme="dark"] .empty strong,
:root[data-theme="dark"] .metric b,
:root[data-theme="dark"] .workspace-card h3 {
  color: var(--text);
}
:root[data-theme="dark"] .metric span,
:root[data-theme="dark"] .panel-head p {
  color: var(--muted);
}
:root[data-theme="dark"] input:not([type]),
:root[data-theme="dark"] input[type=text],
:root[data-theme="dark"] input[type=email],
:root[data-theme="dark"] input[type=password],
:root[data-theme="dark"] input[type=search],
:root[data-theme="dark"] input[type=tel],
:root[data-theme="dark"] input[type=url],
:root[data-theme="dark"] input[type=number],
:root[data-theme="dark"] input[type=date],
:root[data-theme="dark"] input[type=time],
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: var(--field);
  border-color: var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
:root[data-theme="dark"] .progress-loader {
  background: rgba(7, 11, 19, .76);
}
:root[data-theme="dark"] .progress-card {
  background: rgba(13,20,33,.96);
  border-color: var(--line-strong);
}
:root[data-theme="dark"] .intro-card { color: var(--text); }
:root[data-theme="dark"] .app-intro {
  background:
    radial-gradient(circle at 50% 35%, rgba(87,162,255,.22), transparent 18rem),
    var(--bg);
}

@media (max-width: 720px) {
  .topbar {
    height: 58px;
    gap: 8px;
    padding: 0 12px;
  }
  .icon-btn,
  .search-trigger,
  .ask-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 10px;
  }
  .btn {
    min-height: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 12.5px;
  }
  .btn-sm {
    min-height: 30px;
    height: 30px;
    padding: 0 9px;
  }
  .content { padding: 18px 12px 44px; }
  .page-head { margin-bottom: 18px; }
  .attendance-hero { padding: 18px; }
  .attendance-hero-main {
    align-items: center;
    margin-bottom: 16px;
  }
  .attendance-hero-main .btn {
    width: 36px;
    padding: 0;
    overflow: hidden;
  }
  .attendance-hero-main .btn .i { margin: 0; }
  .attendance-hero-main .btn span { display: none; }
  .attendance-hero-grid {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
  }
  .attendance-ring { width: 92px; }
  .attendance-ring b { font-size: 22px; }
  .att-legend-hero { grid-template-columns: minmax(0, 1fr); }
  .horizon-compact .horizon-figures {
    width: 100%;
    justify-content: space-between;
  }
  .pwa-prompt {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
  .pwa-prompt-actions .btn {
    flex: 0 0 auto;
  }
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }
}
