/* ============================================================
   shared.css
   Global tokens, reset, and primitive utility classes.
   Component-specific styles live in scoped <style> blocks.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500&display=swap');

/* ── TOKENS: DARK (default) ──────────────────────────────── */
:root {
  --bg:          #111110;
  --surface:     #191918;
  --surface2:    #222220;
  --border:      #2e2e2b;
  --border2:     #3a3a36;

  --text:        #d4d4ce;
  --text-dim:    #7a7a72;
  --text-faint:  #454540;

  --ochre:       #c8860a;
  --ochre-dim:   #8a5c06;
  --ochre-bg:    #1e1608;

  --teal:        #3fa89a;
  --teal-dim:    #27706a;
  --teal-bg:     #071514;

  --red:         #c1441a; /*#c0392b;*/
  --red-dim:     #7a2e10; /*#7a1f1a;*/
  --red-bg:      #2a1508; /*#1a0a09;*/

  --green:       #4a9e6a;
  --green-dim:   #2e5c3e;
  --green-bg:    #071209;

  /* Typography */
  --font-mono:   'IBM Plex Mono', monospace;
  --font-sans:   'IBM Plex Sans', sans-serif;
  --editable-font-size: 13px;

  /* Layout */
  --header-h:              48px;
  --sidebar-w:             240px;
  --sidebar-collapsed-w:   48px;
  --sidebar-transition:    200ms ease;
  --content-max-width:     720px;
  --margin-left-smaller:   5%;
  --column-gap:            28px;

  /* Misc */
  --card-gap:    8px;
}

/* ── TOKENS: LIGHT ───────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f5f4f0;
  --surface:     #eceae4;
  --surface2:    #e2e0d8;
  --border:      #ccc9be;
  --border2:     #b8b5a8;

  --text:        #1c1c1a;
  --text-dim:    #5a5a52;
  --text-faint:  #9a9a90;

  --ochre:       #a86c04;
  --ochre-dim:   #c8860a;
  --ochre-bg:    #f5ead8;

  --teal:        #207a70;
  --teal-dim:    #3fa89a;
  --teal-bg:     #d8efec;

  --red:         #a02820;
  --red-dim:     #c0392b;
  --red-bg:      #f5dbd9;

  --green:       #2e7a4a;
  --green-dim:   #4a9e6a;
  --green-bg:    #d8ede2;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
  margin: 0 !important;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s, border-color 0.1s, filter 0.1s;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 10px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-primary {
  background: var(--ochre);
  color: #fdf6e0;
  border-color: var(--ochre);
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border2);
}
.btn-secondary:hover { color: var(--text); background: var(--surface); }

.btn-ghost {
  background: transparent;
  color: var(--text-faint);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text-dim); background: var(--surface); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red-dim);
}
.btn-danger:hover { background: var(--red-bg); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border: 1px solid;
}

.badge::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-active  { color: var(--teal);     border-color: var(--teal-dim);  background: var(--teal-bg);  }
.badge-active::before  { background: var(--teal); }

.badge-pending { color: var(--ochre);    border-color: var(--ochre-dim); background: var(--ochre-bg); }
.badge-pending::before { background: var(--ochre); }

.badge-error   { color: var(--red);      border-color: var(--red-dim);   background: var(--red-bg);   }
.badge-error::before   { background: var(--red); }

.badge-neutral { color: var(--text-dim); border-color: var(--border2);   background: var(--surface2); }
.badge-neutral::before { background: var(--text-faint); }

/* ── INPUTS ──────────────────────────────────────────────── */
.input {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 12px;
  outline: none;
  width: 100%;
  transition: border-color 0.1s, background 0.2s;
}

.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--ochre-dim); }

/* ── FORM FIELDS (stacked label + input) ─────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.validation-error {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--red);
  margin-top: 2px;
}

/* ── SECTION PRIMITIVES ──────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}

.page-title .muted {
  color: var(--text-faint);
  font-weight: 400;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-top: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 16px;
  text-align: left;
  font-weight: 400;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.08s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface); }

td {
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--text);
}

td.mono { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
td.dim  { color: var(--text-dim); }

/* ── TINYMCE OVERRIDES ───────────────────────────────────── */
.tox-tinymce {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.tox-toolbar,
.tox-toolbar__primary,
.tox-toolbar__overflow,
.tox-menubar,
.tox-statusbar,
.tox-sidebar-wrap,
.tox-edit-area {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background-color: var(--surface) !important;
}

.tox-tinymce:focus,
.tox-edit-focus {
  box-shadow: none !important;
}

.mce-content-body {
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 1em;
  line-height: 1.6;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

/* ── MOBILE GLOBALS ──────────────────────────────────────── */

/* Prevent tap highlight flash on mobile */
* { -webkit-tap-highlight-color: transparent; }

/* All interactive elements meet 44px minimum touch target */
button, a, [role="button"] { min-height: 44px; }

/* Inputs large enough to avoid iOS zoom-on-focus */
input, select, textarea { font-size: 16px; }

/* Responsive page padding utility */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-actions { width: 100%; }
  .input { width: 100%; }
}