:root {
  --bg: #070b12;
  --panel: #0f1726;
  --panel-2: #16233a;
  --text: #f2f7ff;
  --muted: #9eb0cb;
  --lime: #d3ff63;
  --blue: #1f86ff;
  --cyan: #5dd5ff;
  --danger: #ff627b;
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Manrope, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #17325a 0%, transparent 30%),
              radial-gradient(circle at 90% 20%, #0f4c62 0%, transparent 35%),
              var(--bg);
  min-height: 100vh;
  padding: 24px;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(211,255,99,0.06), rgba(31,134,255,0.08));
  pointer-events: none;
}

.header, .metrics, .timeline { position: relative; z-index: 1; }
.header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}
h1 {
  margin: 0;
  font-family: Space Grotesk, sans-serif;
  font-size: 36px;
}
p { margin: 8px 0 0; color: var(--muted); }

.header-actions { display: flex; gap: 10px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid #355072;
  border-radius: 999px;
  padding: 8px 10px;
  background: #11213a;
  color: #d7e3f4;
  white-space: nowrap;
}
.status-pill.status-on {
  border-color: #67d89b;
  color: #baf3d2;
  background: rgba(57, 217, 138, 0.14);
}
.status-pill.status-off {
  border-color: #ff6f8e;
  color: #ffb4c4;
  background: rgba(255, 98, 123, 0.14);
}
.status-pill.status-unknown {
  border-color: #8ea4c4;
  color: #c5d1e4;
  background: rgba(142, 164, 196, 0.12);
}
.alerts-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #355072;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #11213a;
  position: relative;
}
.alerts-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #7f8fa8;
  box-shadow: 0 0 0 2px rgba(127, 143, 168, 0.2);
}
.alerts-icon.granted .alerts-dot {
  background: #39d98a;
  box-shadow: 0 0 0 2px rgba(57, 217, 138, 0.2);
}
.alerts-icon.default .alerts-dot {
  background: #f7c948;
  box-shadow: 0 0 0 2px rgba(247, 201, 72, 0.2);
}
.alerts-icon.denied .alerts-dot {
  background: #ff627b;
  box-shadow: 0 0 0 2px rgba(255, 98, 123, 0.2);
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: linear-gradient(120deg, var(--lime), #9ddc2d); color: #111; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid #355072; }
.page-btn.active {
  background: rgba(211, 255, 99, 0.14);
  border-color: #9edc3e;
  color: #d7ff77;
}
.hidden { display: none !important; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.metric {
  background: linear-gradient(145deg, rgba(22,35,58,0.92), rgba(13,22,37,0.92));
  border: 1px solid #274364;
  border-radius: var(--radius);
  padding: 12px;
}
.metric b { display:block; font-size: 24px; margin-top: 6px; }

.timeline {
  display: grid;
  gap: 14px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 24px !important;
}
.shared-calendar {
  background: linear-gradient(160deg, rgba(15,23,38,0.95), rgba(11,19,33,0.95));
  border: 1px solid #2b3f5f;
  border-radius: var(--radius);
  overflow: auto;
  max-height: 74vh;
}
.shared-calendar.monthly {
  max-height: none;
}
.monthly-head {
  display: grid;
  grid-template-columns: repeat(var(--acct-count, 1), minmax(280px, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #223a5d;
  background: #1a2b45;
}
.monthly-head .account-head {
  background: #132744;
  border: 1px solid #2b4368;
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}
.monthly-head .account-head.account-colored {
  border-color: var(--acct-color, #2b4368);
  box-shadow: inset 0 0 0 1px var(--acct-color-soft, rgba(93,213,255,0.14));
}
.monthly-head .account-head.account-colored .account-title strong {
  text-shadow: 0 0 10px var(--acct-color-soft, rgba(93,213,255,0.12));
}
.monthly-head .account-head.target-reached {
  background: linear-gradient(145deg, rgba(35, 68, 54, 0.95), rgba(21, 45, 38, 0.95));
  border-color: #7fbe63;
  box-shadow: inset 0 0 0 1px rgba(160, 227, 121, 0.18);
}
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid #223a5d;
  border-bottom: 1px solid #223a5d;
  background: #12243e;
  position: relative;
}
.month-nav-left {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto;
}
.month-total {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #355072;
  background: #102039;
  white-space: nowrap;
}
.month-total.pos {
  border-color: #67d89b;
  color: #baf3d2;
  background: rgba(57, 217, 138, 0.12);
}
.month-total.neg {
  border-color: #ff6f8e;
  color: #ffb4c4;
  background: rgba(255, 98, 123, 0.12);
}
.month-total.flat {
  border-color: #8ea4c4;
  color: #c5d1e4;
  background: rgba(142, 164, 196, 0.1);
}
.month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 10px 12px 0;
  color: var(--muted);
  font-weight: 700;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 8px 12px 12px;
}
.day-cell {
  min-height: 128px;
  background: #132744;
  border: 1px solid #28476d;
  border-radius: 12px;
  padding: 8px;
}
.day-cell.today {
  border-color: #9edc3e;
  box-shadow: inset 0 0 0 1px rgba(158, 220, 62, 0.25), 0 0 0 1px rgba(158, 220, 62, 0.18);
  background: linear-gradient(160deg, rgba(22, 50, 40, 0.9), rgba(19, 39, 68, 0.95));
}
.day-cell.muted {
  opacity: 0.5;
}
.day-num {
  font-weight: 800;
  margin-bottom: 6px;
}
.today-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #111;
  background: #d3ff63;
  vertical-align: middle;
}
.day-marker {
  font-size: 11px;
  padding: 5px 7px;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid #2f4a6e;
  background: #11213a;
}
.day-marker.eta1 {
  border-color: #9edc3e;
  color: #d5ff7a;
  background: rgba(211,255,99,0.12);
}
.day-marker.eta2 {
  border-color: #58b6ff;
  color: #9dd8ff;
  background: rgba(31,134,255,0.14);
}
.day-marker.wkpos {
  border-color: #67d89b;
  color: #baf3d2;
  background: rgba(57, 217, 138, 0.14);
}
.day-marker.wkneg {
  border-color: #ff6f8e;
  color: #ffb4c4;
  background: rgba(255, 98, 123, 0.14);
}
.day-marker.wkflat {
  border-color: #8ea4c4;
  color: #c5d1e4;
  background: rgba(142, 164, 196, 0.12);
}
.day-marker.quiet {
  opacity: 0.4;
}
.shared-head, .shared-row {
  display: grid;
  grid-template-columns: 110px 120px repeat(var(--acct-count, 1), minmax(180px, 1fr));
  gap: 8px;
  min-width: 760px;
  padding: 10px 12px;
}
.shared-head {
  background: #1a2b45;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: start;
}
.shared-row {
  border-top: 1px solid #223a5d;
  background: #132744;
}
.account-head small {
  display: block;
  color: var(--muted);
  font-weight: 600;
}
.account-head {
  display: block;
  position: relative;
}
.account-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.account-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-actions {
  display: flex;
  gap: 6px;
}
.icon-btn {
  width: 38px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.head-progress-wrap {
  margin-top: 8px;
  background: #0a1220;
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
  border: 1px solid #28476d;
  position: relative;
}
.head-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}
.head-progress-wrap.zero-axis::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.35);
}
.zero-mark {
  position: absolute;
  left: calc(50% - 6px);
  top: -14px;
  font-size: 10px;
  color: #b8c8df;
}
.axis-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
}
.axis-fill.pos {
  background: linear-gradient(90deg, #39d98a, #91f2be);
}
.axis-fill.neg {
  background: linear-gradient(90deg, #ff8a9f, #ff4c72);
}
.account-head-chips {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.account-head .kpi {
  font-size: 11px;
  padding: 6px 8px;
}
.account-head .btn {
  padding: 6px 10px;
}
.week-label {
  font-weight: 800;
}
.cal-cell {
  background: #11213a;
  border: 1px solid #28476d;
  border-radius: 10px;
  padding: 6px 8px;
  display: inline-block;
}
.cal-cell.empty {
  opacity: 0.5;
}
.cal-cell.eta-hit {
  border-color: var(--lime);
  background: rgba(211,255,99,0.12);
}
.cal-cell.eta-hit b {
  color: var(--lime);
  margin-left: 6px;
}
.cal-cell.eta-pending {
  border-color: #3a5f8a;
  color: #b5c8e5;
}
.cal-cell.eta-past {
  border-color: #6b3c4a;
  color: #ff9fb0;
}
.cal-cell.neutral {
  opacity: 0.55;
}
.account-card {
  background: linear-gradient(160deg, rgba(15,23,38,0.95), rgba(11,19,33,0.95));
  border: 1px solid #2b3f5f;
  border-radius: var(--radius);
  padding: 16px;
  animation: in 400ms ease both;
}
@keyframes in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.card-top {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  align-items: flex-start;
}
.card-top-left { min-width: 0; }
.phase-pill {
  background: rgba(211,255,99,0.16);
  color: var(--lime);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.phase-lane {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
}
.phase-box {
  position: relative;
  background: var(--panel-2);
  border: 1px solid #365379;
  border-radius: 14px;
  padding: 12px;
}
.phase-box:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -14px;
  width: 2px;
  height: 14px;
  background: linear-gradient(180deg, var(--cyan), rgba(93, 213, 255, 0.15));
}
.phase-box.current { border-color: var(--lime); box-shadow: inset 0 0 0 1px rgba(211,255,99,0.35); }
.phase-box h4 { margin: 0 0 8px; font-size: 15px; }
.phase-box small { color: var(--muted); display:block; margin-top: 3px; }

.progress-wrap {
  margin-top: 10px;
  background: #0a1220;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.card-kpis {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.header-kpis {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.kpi {
  padding: 8px 10px;
  border-radius: 10px;
  background: #11213a;
  border: 1px solid #28476d;
  font-size: 12px;
}
.feed-kpi {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.title-feed {
  margin-left: 2px;
  font-size: 11px;
  padding: 4px 8px;
}
.feed-state {
  font-weight: 800;
  letter-spacing: 0.02em;
}
.feed-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}
.feed-dot.ok {
  background: #39d98a;
  box-shadow: 0 0 0 2px rgba(57, 217, 138, 0.18);
}
.feed-dot.bad {
  background: #ff627b;
  box-shadow: 0 0 0 2px rgba(255, 98, 123, 0.18);
}

.account-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 14px;
  align-items: start;
}

.dialog {
  width: min(960px, 95vw);
  border: none;
  border-radius: var(--radius);
  background: #0d1524;
  color: var(--text);
  padding: 18px;
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
label { display:block; font-size: 12px; color: var(--muted); }
input, textarea {
  width: 100%;
  margin-top: 4px;
  margin-bottom: 8px;
  background: #122038;
  color: var(--text);
  border: 1px solid #2f4a6e;
  border-radius: 10px;
  padding: 8px;
}
select {
  width: 100%;
  margin-top: 4px;
  margin-bottom: 8px;
  background: #122038;
  color: var(--text);
  border: 1px solid #2f4a6e;
  border-radius: 10px;
  padding: 8px 34px 8px 10px;
  font: inherit;
  line-height: 1.2;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #8fb4e6 50%),
    linear-gradient(135deg, #8fb4e6 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
select:focus {
  outline: none;
  border-color: #5aa3ff;
  box-shadow: 0 0 0 2px rgba(31, 134, 255, 0.2);
}
select:hover {
  border-color: #3b6291;
}
.phase-row {
  display:grid;
  grid-template-columns: 1.2fr 1fr;
  gap:6px;
  margin-bottom: 6px;
}
.form-actions { display:flex; justify-content:flex-end; gap:8px; margin-top: 14px; }

.week-grid {
  background: #111e33;
  border: 1px solid #2f4a6e;
  border-radius: 14px;
  overflow: hidden;
}
.week-head, .week-row {
  display: grid;
  grid-template-columns: 0.9fr 1fr 0.8fr 1fr;
  gap: 8px;
  padding: 9px 10px;
  font-size: 13px;
}
.week-head {
  background: #1a2b45;
  font-weight: 800;
}
.week-row {
  border-top: 1px solid #223a5d;
}
.week-row span:nth-child(1) {
  font-weight: 700;
}
.eta-row {
  background: rgba(211, 255, 99, 0.1);
}
.eta-row span:last-child {
  color: var(--lime);
  font-weight: 800;
}

.analytics-stack {
  display: grid;
  gap: 14px;
}

.dashboard-stack {
  display: grid;
  gap: 16px;
}

.tracker-panel {
  background: linear-gradient(160deg, rgba(15,23,38,0.95), rgba(11,19,33,0.95));
  border: 1px solid #2b3f5f;
  border-radius: var(--radius);
  overflow: hidden;
}

.account-dashboard {
  background: linear-gradient(160deg, rgba(15,23,38,0.95), rgba(11,19,33,0.95));
  border: 1px solid var(--acct-color, #2b3f5f);
  box-shadow: inset 0 0 0 1px var(--acct-color-soft, rgba(93,213,255,0.12));
  border-radius: var(--radius);
  padding: 16px;
}

.account-analytics {
  background: linear-gradient(160deg, rgba(15,23,38,0.95), rgba(11,19,33,0.95));
  border: 1px solid var(--acct-color, #2b3f5f);
  box-shadow: inset 0 0 0 1px var(--acct-color-soft, rgba(93,213,255,0.12));
  border-radius: var(--radius);
  padding: 0;
  border: 0;
  box-shadow: none;
}

.analytics-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.analytics-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.analytics-title {
  font-family: Space Grotesk, sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.analytics-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.analytics-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.dashboard-kpis {
  margin-bottom: 16px;
}

.analytics-kpis .metric {
  min-height: 92px;
}

.analytics-kpis .metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.panel-table {
  background: #111e33;
  border: 1px solid #2f4a6e;
  border-radius: 14px;
  overflow: hidden;
}

.chart-panel {
  min-height: 210px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.chart-wrap {
  padding: 12px;
  height: 150px;
}

.sparkline {
  width: 100%;
  height: 120px;
  display: block;
}

.chart-baseline {
  stroke: rgba(201, 214, 232, 0.35);
  stroke-width: 1;
  stroke-dasharray: 5 4;
}

.chart-empty {
  height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.panel-title {
  padding: 12px 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  border-bottom: 1px solid #223a5d;
  background: #162843;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.analytics-table th,
.analytics-table td {
  padding: 10px 12px;
  border-top: 1px solid #223a5d;
  text-align: left;
}

.analytics-table thead th {
  border-top: 0;
  background: #1a2b45;
  font-size: 12px;
  color: #cdd8e7;
}

.analytics-table tbody tr:nth-child(even) {
  background: rgba(18, 32, 56, 0.45);
}

.kpi.warn {
  border-color: #ffb86b;
  color: #ffd0a0;
  background: rgba(255, 184, 107, 0.12);
}

.analytics-table .pos {
  color: #8cf0ba;
  font-weight: 700;
}

.analytics-table .neg {
  color: #ff9eb0;
  font-weight: 700;
}

.table-empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .grid-two { grid-template-columns: 1fr; }
  .header { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 28px; }
  .account-grid { grid-template-columns: 1fr; }
  .monthly-head { grid-template-columns: 1fr; }
  .analysis-filters { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .analysis-head { align-items: flex-start; flex-direction: column; }
  .analytics-head { flex-direction: column; }
  .analytics-head-right { align-items: flex-start; width: 100%; }
  .analytics-pills { justify-content: flex-start; }
  .analytics-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
}


