/* ══ KEY METRICS CARD ══ */
.km-metrics-list {
  display: flex; flex-direction: column; gap: 10px;
  margin: 14px 0 12px;
}
.km-metric-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: #0d1015; border: 1px solid #1f2530; border-radius: 8px;
  transition: border-color 0.15s;
}
.km-metric-item:hover { border-color: #2a3040; }
.km-metric-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.km-metric-body { flex: 1; }
.km-metric-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: #7a8a9b; margin-bottom: 2px;
}
.km-metric-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px; font-weight: 900; color: #dce3ed; line-height: 1;
}
.km-metric-unit {
  font-size: 12px; font-weight: 600; color: #7a8a9b;
}
.km-manage-btn {
  width: 100%; background: transparent; border: 1px dashed #2a3040;
  border-radius: 7px; padding: 7px; cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif; font-size: 10px;
  font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: #2a3040; transition: all 0.15s; margin-top: 4px;
}
.km-manage-btn:hover { border-color: #7a8a9b; color: #7a8a9b; }

/* ══ ADD EVENT MODAL ══ */
.ae-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); z-index: 400;
}
.ae-backdrop.open { display: block; }
.ae-modal {
  display: none; position: fixed; top: 30px; bottom: 30px; left: 50%;
  transform: translateX(-50%);
  width: min(780px, calc(100vw - 40px));
  background: #0f1318; border: 1px solid #2a3040; border-radius: 16px;
  z-index: 401; flex-direction: column; overflow: hidden;
}
.ae-modal.open { display: flex; }
.ae-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 16px; border-bottom: 1px solid #1f2530; flex-shrink: 0;
}
.ae-header-left { display: flex; align-items: center; gap: 14px; }
.ae-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: #dce3ed;
}
.ae-subtitle {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px; font-weight: 600; color: #d4f542;
  letter-spacing: 1px; text-transform: uppercase;
}
.ae-body {
  display: flex; gap: 0; flex: 1; min-height: 0; overflow: hidden;
}
.ae-left {
  flex: 1; padding: 20px 22px; overflow-y: auto; display: flex;
  flex-direction: column; gap: 14px;
}
.ae-left::-webkit-scrollbar { width: 3px; }
.ae-left::-webkit-scrollbar-thumb { background: #2a3040; border-radius: 2px; }
.ae-right {
  width: 200px; flex-shrink: 0; padding: 20px 18px;
  border-left: 1px solid #1f2530; background: #0d1015;
}
.ae-field-row { display: flex; gap: 12px; }
.ae-field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.ae-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: #7a8a9b;
}
.ae-hint { color: #2a3040; font-weight: 600; }
.ae-input {
  background: #0d1015; border: 1px solid #2a3040; border-radius: 7px;
  padding: 8px 11px; font-family: 'Barlow', sans-serif;
  font-size: 13px; color: #dce3ed; outline: none;
  transition: border-color 0.15s, background 0.15s;
  width: 100%; box-sizing: border-box;
}
.ae-input:focus { border-color: #d4f542; background: rgba(212,245,66,0.03); }
.ae-input::placeholder { color: #2a3040; font-size: 12px; }
.ae-select { cursor: pointer; }
.ae-select option { background: #141820; }
.ae-input-num { font-family: 'Barlow Condensed', sans-serif; font-size: 15px; }
.ae-textarea { resize: vertical; min-height: 72px; font-size: 12px; }

/* ── Track manager open button (shared: ae-modal + cal-event-modal) ── */
.tm-open-btn {
  background: transparent; border: 1px solid #2a3040; border-radius: 5px;
  color: #7a8a9b; font-size: 13px; font-weight: 700; line-height: 1;
  padding: 1px 5px; cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
.tm-open-btn:hover { border-color: #d4f542; color: #d4f542; }
body.light-mode .tm-open-btn { border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .tm-open-btn:hover { border-color: #5a7a00; color: #5a7a00; }

/* ── Track manager modal body ── */
.tm-track-row {
  display: flex; flex-direction: column; gap: 0;
  border: 1px solid #1f2530; border-radius: 8px; overflow: hidden; margin-bottom: 10px;
}
.tm-track-header {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: #0d1015;
}
.tm-track-name { flex: 1; font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700; color: #dce3ed; }
.tm-track-delete {
  background: transparent; border: 1px solid #2a3040; border-radius: 5px;
  color: #7a8a9b; font-size: 11px; padding: 3px 8px; cursor: pointer; transition: all 0.15s;
}
.tm-track-delete:hover { border-color: #ef4444; color: #ef4444; }
.tm-layouts { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 5px; background: #0a0d10; }
.tm-layout-row {
  display: flex; align-items: center; gap: 8px;
}
.tm-layout-name { flex: 1; font-size: 12px; color: #b0bccc; }
.tm-layout-len { font-size: 11px; color: #5a6678; font-family: 'Barlow Condensed', sans-serif; }
.tm-layout-delete {
  background: transparent; border: none; color: #3a4555; font-size: 12px;
  cursor: pointer; padding: 2px 5px; transition: color 0.15s; line-height: 1;
}
.tm-layout-delete:hover { color: #ef4444; }
.tm-add-layout-btn {
  background: transparent; border: 1px dashed #2a3040; border-radius: 5px;
  color: #3a4555; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; padding: 4px 8px; cursor: pointer; width: 100%;
  margin-top: 4px; transition: all 0.15s;
}
.tm-add-layout-btn:hover { border-color: #d4f542; color: #d4f542; }
.tm-inline-form {
  display: flex; gap: 6px; align-items: center; margin-top: 6px;
}
.tm-inline-input {
  flex: 1; background: #0d1015; border: 1px solid #2a3040; border-radius: 6px;
  padding: 5px 8px; font-family: 'Barlow', sans-serif; font-size: 12px; color: #dce3ed; width: 0;
}
.tm-inline-input:focus { outline: none; border-color: #d4f542; }
.tm-inline-input::placeholder { color: #3a4555; }
.tm-inline-btn {
  background: #d4f542; border: none; border-radius: 6px;
  padding: 5px 10px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: #000; cursor: pointer; white-space: nowrap;
}
.tm-inline-btn-cancel {
  background: transparent; border: 1px solid #2a3040; border-radius: 6px;
  padding: 5px 8px; font-size: 10px; color: #7a8a9b; cursor: pointer;
}
.tm-empty { color: #3a4555; font-size: 12px; padding: 8px 0; text-align: center; }
/* Layout length edit button */
.tm-layout-len-btn {
  background: transparent; border: 1px solid #2a3040; border-radius: 4px;
  color: #7a8a9b; font-size: 11px; font-family: 'Barlow Condensed', sans-serif;
  padding: 2px 6px; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.tm-layout-len-btn:hover { border-color: #d4f542; color: #d4f542; }

/* Standard circuits section */
.tm-section-label {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: #5a6678;
  padding: 4px 0 8px; margin-top: 4px;
}
.tm-section-label-std { margin-top: 16px; border-top: 1px solid #1f2530; padding-top: 14px; }
.tm-std-list { display: flex; flex-direction: column; gap: 3px; }
.tm-std-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border: 1px solid #1a1f28; border-radius: 6px; background: #0a0d10;
}
.tm-std-row .tm-track-name { flex: 1; font-size: 12px; color: #8899aa; }
.tm-std-row .tm-layout-len { font-size: 11px; color: #5a6678; flex-shrink: 0; }
.tm-std-add-btn {
  background: transparent; border: 1px solid #2a3040; border-radius: 5px;
  color: #5a6678; font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
  text-transform: uppercase; padding: 3px 7px; cursor: pointer; flex-shrink: 0;
  transition: all 0.15s;
}
.tm-std-add-btn:hover { border-color: #d4f542; color: #d4f542; }
.tm-layout-len-missing { color: #3a4555 !important; }

/* Combobox length tag */
.combobox-option-len {
  font-size: 10px; font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
  color: #5a6678; white-space: nowrap;
}

body.light-mode .tm-track-row { border-color: #dde2ec; }
body.light-mode .tm-track-header { background: #f8f9fc; }
body.light-mode .tm-track-name { color: #1a2030; }
body.light-mode .tm-layouts { background: #f0f3f8; }
body.light-mode .tm-layout-name { color: #3a4a5a; }
body.light-mode .tm-inline-input { background: #fff; border-color: #dde2ec; color: #1a2030; }
body.light-mode .tm-std-row { background: #f8f9fc; border-color: #e8ecf2; }
body.light-mode .tm-std-row .tm-track-name { color: #3a4a5a; }
body.light-mode .tm-section-label-std { border-top-color: #e8ecf2; }
body.light-mode .combobox-option-len { color: #8899aa; }
body.light-mode .tm-layout-len-btn { border-color: #dde2ec; color: #6b7a8d; }
.ae-situation-box {
  background: #0f1318; border: 1px solid #1f2530; border-radius: 10px; padding: 14px;
}
.ae-situation-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: #7a8a9b; margin-bottom: 12px;
}
.ae-situation-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.ae-situation-label {
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px;
  font-weight: 600; color: #2a3040; letter-spacing: 0.3px;
}
.ae-situation-val {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px;
  font-weight: 700; color: #7a8a9b;
}
.ae-situation-val.ae-computed { color: #d4f542; }
.ae-situation-divider { border-top: 1px solid #1f2530; margin: 10px 0; }
.ae-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-top: 1px solid #1f2530; flex-shrink: 0;
}
.ae-error {
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px;
  font-weight: 600; color: #ef4444; letter-spacing: 0.3px;
}

/* ── Light mode ── */
body.light-mode .km-metric-item { background: #f8f9fc; border-color: #dde2ec; }
body.light-mode .km-metric-item:hover { border-color: #b0b8c4; }
body.light-mode .km-metric-value { color: #1a2030; }
body.light-mode .km-manage-btn { border-color: #dde2ec; color: #b0b8c4; }
body.light-mode .km-manage-btn:hover { border-color: #8899aa; color: #6b7a8d; }
body.light-mode .ae-backdrop { background: rgba(0,0,0,0.35); }
body.light-mode .ae-modal { background: #ffffff; border-color: #dde2ec; }
body.light-mode .ae-header { border-bottom-color: #e8ecf2; }
body.light-mode .ae-title { color: #1a2030; }
body.light-mode .ae-subtitle { color: #5a7a00; }
body.light-mode .ae-label { color: #6b7a8d; }
body.light-mode .ae-hint { color: #b0b8c4; }
body.light-mode .ae-input { background: #f0f3f8; border-color: #dde2ec; color: #1a2030; }
body.light-mode .ae-input:focus { border-color: #5a7a00; background: rgba(90,122,0,0.03); }
body.light-mode .ae-input::placeholder { color: #b0b8c4; }
body.light-mode .ae-select option { background: #ffffff; }
body.light-mode .ae-right { border-left-color: #e8ecf2; background: #f8f9fc; }
body.light-mode .ae-situation-box { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .ae-situation-label { color: #b0b8c4; }
body.light-mode .ae-situation-val { color: #6b7a8d; }
body.light-mode .ae-situation-val.ae-computed { color: #5a7a00; }
body.light-mode .ae-situation-divider { border-top-color: #dde2ec; }
body.light-mode .ae-footer { border-top-color: #e8ecf2; }

/* ══ COMPLIANCE / FIA DEADLINES CARD ══ */
.compliance-list {
  display: flex; flex-direction: column; gap: 7px;
  margin: 12px 0 10px;
  min-height: 28px;
}
.compliance-empty {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; color: #3a4555; text-align: center;
  padding: 12px 0; letter-spacing: 0.5px;
}
.compliance-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 12px;
  background: #0d1015; border: 1px solid #1f2530; border-radius: 8px;
  transition: border-color 0.15s;
}
.compliance-item:hover { border-color: #2a3040; }
.compliance-item-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.compliance-item-dot.ok       { background: #22c55e; }
.compliance-item-dot.soon     { background: #f59e0b; box-shadow: 0 0 5px rgba(245,158,11,0.4); }
.compliance-item-dot.overdue  { background: #ef4444; box-shadow: 0 0 5px rgba(239,68,68,0.5); }
.compliance-item-body { flex: 1; min-width: 0; }
.compliance-item-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 700; color: #dce3ed;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.compliance-item-date {
  font-size: 11px; color: #7a8a9b; margin-top: 1px;
}
.compliance-countdown {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  border-radius: 5px; padding: 2px 7px; white-space: nowrap; flex-shrink: 0;
}
.compliance-countdown.ok      { color: #22c55e; background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.2); }
.compliance-countdown.soon    { color: #f59e0b; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); }
.compliance-countdown.overdue { color: #ef4444; background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.25); }
.compliance-item-actions {
  display: flex; gap: 4px; flex-shrink: 0;
}
.compliance-reorder-btn {
  background: transparent; border: 1px solid #1f2530; border-radius: 5px;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #4a5a6b; font-size: 10px; transition: all 0.12s; padding: 0;
}
.compliance-reorder-btn:hover { border-color: #7a8a9b; color: #dce3ed; }
.compliance-reorder-btn:disabled { opacity: 0.25; cursor: default; }
.compliance-delete-btn {
  background: transparent; border: 1px solid #1f2530; border-radius: 5px;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #4a5a6b; font-size: 10px; transition: all 0.12s; padding: 0;
}
.compliance-delete-btn:hover { border-color: #ef4444; color: #ef4444; }

/* ── Compliance modal ── */
.compliance-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); z-index: 490;
}
.compliance-backdrop.open { display: block; }
.compliance-modal {
  display: none; position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  background: #0f1318; border: 1px solid #2a3040; border-radius: 14px;
  z-index: 491; flex-direction: column; overflow: hidden;
}
.compliance-modal.open { display: flex; }
.compliance-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 14px; border-bottom: 1px solid #1f2530;
}
.compliance-modal-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 800;
  letter-spacing: 1.2px; text-transform: uppercase; color: #dce3ed;
}
.compliance-modal-close {
  background: transparent; border: none; color: #7a8a9b;
  font-size: 14px; cursor: pointer; padding: 0; line-height: 1;
  transition: color 0.12s;
}
.compliance-modal-close:hover { color: #dce3ed; }
.compliance-modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.compliance-modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; padding: 14px 20px; border-top: 1px solid #1f2530;
}

/* ── Light mode ── */
body.light-mode .compliance-item         { background: #f8f9fc; border-color: #dde2ec; }
body.light-mode .compliance-item:hover   { border-color: #b0b8c4; }
body.light-mode .compliance-item-name    { color: #1a2030; }
body.light-mode .compliance-reorder-btn,
body.light-mode .compliance-delete-btn  { border-color: #dde2ec; color: #b0b8c4; }
body.light-mode .compliance-reorder-btn:hover { border-color: #8899aa; color: #6b7a8d; }
body.light-mode .compliance-delete-btn:hover  { border-color: #ef4444; color: #ef4444; }
body.light-mode .compliance-modal        { background: #ffffff; border-color: #dde2ec; }
body.light-mode .compliance-modal-header { border-bottom-color: #e8ecf2; }
body.light-mode .compliance-modal-title  { color: #1a2030; }
body.light-mode .compliance-modal-footer { border-top-color: #e8ecf2; }