/* shared/theme.css — unified palette + base chrome for Tech/Billing/License Audit.
   Keep index.html and license-audit/*.html visually identical: same tokens, same
   dark-mode class mechanism (html.dark, toggled by shared/sidebar.js). */

:root {
  --bg: #f8f7f5;
  --surface: #ffffff;
  --surface2: #f2f1ef;
  --border: rgba(0,0,0,0.12);
  --border-strong: rgba(0,0,0,0.22);
  --text: #1a1a1a;
  --text-muted: #666;
  --text-faint: #999;

  /* Brand — Arden360 navy + vivid blue */
  --accent: #12203a;
  --accent-fg: #fff;
  --brand-word: #12203a;      /* "Arden" wordmark color */

  --green: #1D9E75;
  --green-bg: #e1f5ee;
  --green-text: #0a5c42;
  --red: #E24B4A;
  --red-bg: #fcebeb;
  --red-text: #7a1f1f;
  --amber: #e67700;
  --amber-bg: #faeeda;
  --amber-text: #633806;
  --blue: #2f7bf0;             /* Arden360 accent blue — also the "360" wordmark color */
  --blue-bg: #e6f1fb;
  --blue-text: #0c447c;
  --purple-bg: #f0ebfb;
  --purple-text: #5b21b6;
  --bg-subtle: var(--surface2);

  --radius: 8px;
  --radius-lg: 12px;
}

html.dark {
  --bg: #111213;
  --surface: #1c1d1f;
  --surface2: #26282b;
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.18);
  --text: #e8e9ea;
  --text-muted: #8b8f96;
  --text-faint: #555a63;

  --accent: #e8e9ea;
  --accent-fg: #111213;
  --brand-word: #e8e9ea;       /* navy would vanish on a dark surface — use text color instead */

  --green: #2dbd8c;
  --green-bg: #0d2b22;
  --green-text: #4ecca3;
  --red: #e05555;
  --red-bg: #2a1212;
  --red-text: #f08080;
  --amber: #ffa94d;
  --amber-bg: #2b2010;
  --amber-text: #e8a84a;
  --blue: #4dabf7;
  --blue-bg: #0d1e2e;
  --blue-text: #7ab8f5;
  --purple-bg: #1e1030;
  --purple-text: #c084fc;
  --bg-subtle: var(--surface2);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header (structure only — each page's own inline content is unchanged) */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.2s, border-color 0.2s;
}
header .logo { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
header .logo .word-arden { color: var(--brand-word); }
header .logo .word-360   { color: var(--blue); }
header .status-pill { margin-left: auto; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

#darkToggleBtn {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: 32px; height: 26px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
#darkToggleBtn:hover { background: var(--surface2); color: var(--text); }

/* Toast — unified dismissable/persistent version (adopted from index.html) */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--accent-fg);
  padding: 8px 18px; border-radius: 20px; font-size: 13px;
  display: none; z-index: 999; pointer-events: none;
  max-width: 600px; text-align: center;
}
#toast.toast-error {
  background: var(--red-text); border-radius: var(--radius);
  padding: 10px 16px 10px 18px; pointer-events: all; text-align: left;
  display: flex; align-items: flex-start; gap: 10px;
}
#toast.toast-error .toast-msg { flex: 1; line-height: 1.4; }
#toast.toast-error .toast-close { cursor: pointer; opacity: 0.75; font-size: 16px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
#toast.toast-error .toast-close:hover { opacity: 1; }

.table-wrap { overflow-x: auto; }
.empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Sortable/resizable table framework (shared/apptable.js appTable()) */
.app-table { table-layout: fixed; width: 100%; border-collapse: collapse; font-size: 13px; }
.app-table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; position: relative; }
.app-table th.sortable { cursor: pointer; user-select: none; }
.app-table th.sortable:hover { color: var(--text); }
.app-table th.sort-asc::after  { content: ' ↑'; opacity: 0.8; }
.app-table th.sort-desc::after { content: ' ↓'; opacity: 0.8; }
.app-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-table tr:last-child td { border-bottom: none; }
.app-table tr:hover td { background: var(--surface2); }
.app-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.col-resizer { position: absolute; right: 0; top: 0; bottom: 0; width: 5px; cursor: col-resize; user-select: none; z-index: 1; }
.col-resizer:hover, .col-resizer.resizing { background: var(--green); opacity: 0.5; }

/* Modal (status-change note modal in index.html, write-back modal in
   shared/writeback-modal.js) — one shared definition, used on both. */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); width: 100%; max-width: 520px; box-shadow: 0 8px 32px rgba(0,0,0,0.22); overflow: hidden; }
.modal-header { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-header .modal-title { font-size: 14px; font-weight: 600; line-height: 1.4; }
.modal-header .modal-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-muted); cursor: pointer; padding: 0; line-height: 1; flex-shrink: 0; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 20px; }
.modal-body label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.modal-body textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; font-family: inherit; background: var(--bg); color: var(--text); resize: vertical; min-height: 100px; transition: border-color 0.15s; }
.modal-body textarea:focus { outline: none; border-color: var(--border-strong); background: var(--surface); }
.modal-ai-preview { margin-top: 10px; background: var(--surface2); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; line-height: 1.6; color: var(--text-muted); min-height: 44px; display: none; }
.modal-ai-preview.visible { display: block; color: var(--text); }
.modal-ai-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.modal-footer { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); }
