/* CallDesk — cream ground, graphite ink, colour only where it means something. */

:root {
  --paper:       oklch(0.962 0.009 84);
  --surface:     oklch(0.984 0.006 84);
  --sunken:      oklch(0.936 0.011 84);
  --ink:         oklch(0.255 0.014 265);
  --ink-soft:    oklch(0.455 0.012 265);
  --ink-faint:   oklch(0.615 0.010 265);
  --line:        oklch(0.888 0.010 84);
  --line-firm:   oklch(0.815 0.012 84);

  --accent:      oklch(0.520 0.132 42);
  --accent-wash: oklch(0.940 0.030 42);
  --win:         oklch(0.505 0.115 155);
  --win-wash:    oklch(0.940 0.032 155);
  --warn:        oklch(0.610 0.095 75);
  --warn-wash:   oklch(0.948 0.035 75);
  --stop:        oklch(0.520 0.155 25);
  --stop-wash:   oklch(0.944 0.035 25);
  --idle:        oklch(0.560 0.018 265);

  --r-panel: 10px;
  --r-chip: 6px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --shadow-lift: 0 24px 60px -20px oklch(0.255 0.014 265 / 0.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.num, td.num, .tabular { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- type */

h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; }
.label {
  font-size: 12px; font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
}
.meta { font-size: 12px; color: var(--ink-faint); }
.soft { color: var(--ink-soft); }

/* ---------------------------------------------------------------- panel */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-body { padding: 18px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  border: 1px solid transparent;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), opacity 160ms var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover:not(:disabled) { background: oklch(0.34 0.016 265); }
.btn-primary:active:not(:disabled) { background: oklch(0.22 0.014 265); }

.btn-secondary { background: var(--surface); border-color: var(--line-firm); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--sunken); }

.btn-quiet { color: var(--ink-soft); }
.btn-quiet:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }

.btn-danger { background: var(--stop); color: oklch(0.99 0.005 25); }
.btn-danger:hover:not(:disabled) { background: oklch(0.45 0.155 25); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }

/* ---------------------------------------------------------------- form */

.field { display: grid; gap: 6px; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line-firm);
  border-radius: var(--r-chip); color: var(--ink);
  transition: border-color 160ms var(--ease);
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-wash); }
.input:disabled { background: var(--sunken); color: var(--ink-faint); }
.input::placeholder { color: var(--ink-faint); }

.err-text { color: var(--stop); font-size: 13px; }
.ok-text { color: var(--win); font-size: 13px; }

/* ---------------------------------------------------------------- chips + dots */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: var(--r-chip);
  font-size: 12px; font-weight: 500; background: var(--sunken); color: var(--ink-soft);
}
.chip-win  { background: var(--win-wash);    color: var(--win); }
.chip-warn { background: var(--warn-wash);   color: oklch(0.45 0.09 75); }
.chip-stop { background: var(--stop-wash);   color: var(--stop); }
.chip-accent { background: var(--accent-wash); color: var(--accent); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.dot-live  { background: var(--win); box-shadow: 0 0 0 0 var(--win); animation: pulse 1.8s infinite; }
.dot-warn  { background: var(--warn); }
.dot-stop  { background: var(--stop); }
.dot-idle  { background: var(--ink-faint); }
.dot-off   { background: var(--line-firm); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 oklch(0.505 0.115 155 / 0.5); }
  70%  { box-shadow: 0 0 0 7px oklch(0.505 0.115 155 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.505 0.115 155 / 0); }
}

/* ---------------------------------------------------------------- table */

table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--sunken); text-align: left;
  font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-faint); padding: 9px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: oklch(0.955 0.010 84); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
  padding: 44px 24px; text-align: center; color: var(--ink-faint);
  display: grid; gap: 12px; justify-items: center;
}

/* ---------------------------------------------------------------- utility */

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
