/* Hartasuma Helpdesk — stylesheet
   Type:  IBM Plex Sans (UI + body), IBM Plex Mono (ticket numbers, timestamps, figures)
   Color: teal accent for the product chrome; a separate validated palette for
          status / priority pills and dashboard charts (never the same hue as
          the accent, so data never gets mistaken for UI). */

:root {
  color-scheme: light;
  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #ebeeef;
  --border: #dbe1e2;
  --ink: #101b1f;
  --ink-2: #4b5a5f;
  --ink-muted: #7c8a8d;
  --accent: #0e7c86;
  --accent-strong: #0a5f67;
  --accent-soft: #e3f1f1;
  --shadow: 0 1px 2px rgba(16, 27, 31, 0.06), 0 8px 24px rgba(16, 27, 31, 0.05);

  --status-new: #64748b;
  --status-in-review: #4a3aa7;
  --status-in-progress: #2a78d6;
  --status-resolved: #0ca30c;
  --status-closed: #7c8a8d;

  --priority-low: #64748b;
  --priority-medium: #c98500;
  --priority-high: #ec835a;
  --priority-critical: #d03b3b;

  --cat-1: #2a78d6;
  --cat-2: #eb6834;
  --cat-3: #1baf7a;
  --cat-4: #eda100;
  --cat-5: #e87ba4;
  --cat-6: #008300;
  --cat-7: #4a3aa7;
  --cat-8: #e34948;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1416;
    --surface: #131c1f;
    --surface-2: #1a2528;
    --border: #263133;
    --ink: #eaf1f1;
    --ink-2: #a9babc;
    --ink-muted: #71898c;
    --accent: #35b6be;
    --accent-strong: #59cbd2;
    --accent-soft: #12292b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);

    --status-in-review: #9085e9;
    --status-in-progress: #3987e5;
    --status-new: #8a97a6;
    --status-closed: #71898c;

    --priority-medium: #c98500;
    --priority-high: #ec835a;
    --priority-critical: #e66767;
    --priority-low: #8a97a6;

    --cat-1: #3987e5;
    --cat-2: #d95926;
    --cat-3: #199e70;
    --cat-4: #c98500;
    --cat-5: #d55181;
    --cat-7: #9085e9;
    --cat-8: #e66767;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1416;
  --surface: #131c1f;
  --surface-2: #1a2528;
  --border: #263133;
  --ink: #eaf1f1;
  --ink-2: #a9babc;
  --ink-muted: #71898c;
  --accent: #35b6be;
  --accent-strong: #59cbd2;
  --accent-soft: #12292b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);

  --status-in-review: #9085e9;
  --status-in-progress: #3987e5;
  --status-new: #8a97a6;
  --status-closed: #71898c;

  --priority-medium: #c98500;
  --priority-high: #ec835a;
  --priority-critical: #e66767;
  --priority-low: #8a97a6;

  --cat-1: #3987e5;
  --cat-2: #d95926;
  --cat-3: #199e70;
  --cat-4: #c98500;
  --cat-5: #d55181;
  --cat-7: #9085e9;
  --cat-8: #e66767;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
h1, h2, h3 { font-family: "IBM Plex Sans", sans-serif; font-weight: 600; text-wrap: balance; margin: 0 0 4px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; color: var(--ink-2); }
p { margin: 0 0 12px; color: var(--ink-2); }
a { color: var(--accent-strong); }
code, .mono, .ticket-no, time, .figure { font-family: "IBM Plex Mono", ui-monospace, monospace; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 12px; }
.brand .mark { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; }
.brand .mark .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); flex-shrink: 0; }
.brand .mark .brand-icon { height: 26px; width: auto; flex-shrink: 0; }
.brand .sub { font-size: 0.78rem; color: var(--ink-muted); }
.brand .brand-full { width: 100%; max-width: 168px; height: auto; margin: 0 auto 8px; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-size: 0.92rem; font-weight: 500;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); border-left-color: var(--accent); }
.nav .icon { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 0.78rem; color: var(--ink-muted); }
.theme-toggle {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2);
  border-radius: 8px; padding: 7px 10px; font-size: 0.82rem; cursor: pointer; width: 100%;
}

.main { flex: 1; padding: 30px 34px 60px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 0; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 12px; gap: 10px; }
  .brand { padding: 0 6px 0 0; }
  .brand .sub { display: none; }
  .nav { flex-direction: row; }
  .nav a span.label { white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main { padding: 20px; }
}

/* ---------- cards / surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-tight { padding: 16px 18px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 5px; }
.field .hint { font-size: 0.8rem; color: var(--ink-muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
input[type="text"], input[type="email"], input[type="search"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 0.92rem;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.radio-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 640px) { .radio-cards { grid-template-columns: repeat(2, 1fr); } }
.radio-card { border: 1px solid var(--border); border-radius: 9px; padding: 10px; cursor: pointer; background: var(--bg); }
.radio-card input { display: none; }
.radio-card .name { font-weight: 600; font-size: 0.86rem; display: block; }
.radio-card .desc { font-size: 0.75rem; color: var(--ink-muted); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.honey { position: absolute; left: -9999px; opacity: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 8px; padding: 10px 18px;
  font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; border: 1px solid transparent;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.alert { border-radius: 9px; padding: 12px 14px; font-size: 0.88rem; margin-bottom: 16px; border: 1px solid; }
.alert-error { background: color-mix(in srgb, var(--priority-critical) 12%, var(--surface)); border-color: var(--priority-critical); color: var(--ink); }
.alert-success { background: color-mix(in srgb, var(--status-resolved) 12%, var(--surface)); border-color: var(--status-resolved); color: var(--ink); }
.alert-info { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; white-space: nowrap; letter-spacing: 0.01em;
}
.pill .swatch { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pill-status { background: var(--surface-2); color: var(--ink); }
.pill-priority { background: var(--surface-2); color: var(--ink); }
.badge-recurring {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 700;
  color: var(--priority-high); text-transform: uppercase; letter-spacing: 0.04em;
}

/* ---------- stepper ---------- */
.stepper { display: flex; align-items: center; margin: 18px 0 6px; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.step .node { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--border); z-index: 1; }
.step .label { font-size: 0.72rem; color: var(--ink-muted); margin-top: 7px; text-align: center; }
.step::before {
  content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 2px; background: var(--border); z-index: 0;
}
.step:first-child::before { display: none; }
.step.done .node { background: var(--accent); border-color: var(--accent); }
.step.done::before { background: var(--accent); }
.step.current .node { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.step.current .label { color: var(--ink); font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- filter bar ---------- */
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.filterbar select { width: auto; padding: 7px 10px; font-size: 0.85rem; }
.filterbar .count { margin-left: auto; font-size: 0.82rem; color: var(--ink-muted); }

/* ---------- dashboard ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-tile .label { font-size: 0.76rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-tile .value { font-family: "IBM Plex Mono", monospace; font-size: 1.7rem; font-weight: 600; margin-top: 4px; }
.stat-tile .delta { font-size: 0.78rem; margin-top: 4px; color: var(--ink-muted); }

.barlist { display: flex; flex-direction: column; gap: 10px; }
.barlist .row { display: grid; grid-template-columns: 168px 1fr 52px; align-items: center; gap: 10px; font-size: 0.85rem; }
.barlist .name { color: var(--ink-2); }
.barlist .track { background: var(--surface-2); border-radius: 5px; height: 12px; overflow: hidden; }
.barlist .fill { display: block; height: 100%; border-radius: 5px; }
.barlist .val { text-align: right; font-family: "IBM Plex Mono", monospace; font-size: 0.82rem; }
@media (max-width: 560px) { .barlist .row { grid-template-columns: 92px 1fr 40px; } }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 0.8rem; color: var(--ink-2); }
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 9px; height: 9px; border-radius: 2px; }

.trend-svg { width: 100%; height: 140px; display: block; }
.trend-svg .grid-line { stroke: var(--border); stroke-width: 1; }
.trend-svg .area { fill: color-mix(in srgb, var(--cat-1) 18%, transparent); }
.trend-svg .line { fill: none; stroke: var(--cat-1); stroke-width: 2; }
.trend-svg .dot { fill: var(--cat-1); }
.trend-svg text { fill: var(--ink-muted); font-size: 9px; font-family: "IBM Plex Mono", monospace; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-title h2 { margin: 0; }
.empty { color: var(--ink-muted); font-size: 0.88rem; padding: 20px 0; text-align: center; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
