:root {
  --bg: #f7f7f6;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --border: #e8e6e3;
  --border-strong: #d6d3cf;
  --text: #1f1d1b;
  --text-2: #5c5853;
  --text-3: #8f8a84;
  --accent: #ff4815;
  --accent-hover: #e83d0d;
  --accent-soft: #fff1ec;
  --accent-ring: rgba(255, 72, 21, 0.22);
  --amber: #b45309;
  --amber-soft: #fef6e7;
  --amber-dot: #f59e0b;
  --red: #c62828;
  --red-soft: #fdeeee;
  --red-dot: #e5484d;
  --green: #18794e;
  --green-soft: #ebf7f0;
  --blue: #1f5fbf;
  --blue-soft: #edf3fd;
  --slate: #57534e;
  --slate-soft: #f1f0ee;
  --meta: #0866ff;
  --google: #34a853;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-pop: 0 10px 30px -8px rgba(28, 25, 23, 0.18), 0 2px 6px rgba(28, 25, 23, 0.06);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-3); }
.spacer { flex: 1; }

.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------ boot, gate */

.screen-center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.spinner {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gate-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 32px 28px;
  box-shadow: var(--shadow); display: grid; gap: 12px;
}
.gate-logo { height: 26px; width: auto; margin-bottom: 12px; }
.gate-card h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.gate-form { display: grid; gap: 10px; margin-top: 8px; }
.gate-form label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.sent-note { font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.person-list { display: grid; gap: 6px; margin: 4px 0 6px; }
.person-option {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  font-weight: 500; text-align: left;
}
.person-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.avatar-btn.avatar-text { width: auto; padding: 0 10px; border-radius: 999px; font-size: 11px; }

/* ---------------------------------------------------------------- header */

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 14px 24px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { height: 22px; width: auto; flex: none; }
.brand-rule { width: 1px; height: 28px; background: var(--border); flex: none; }
.brand-text { min-width: 0; }
.brand-text h1 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-text p { font-size: 12.5px; color: var(--text-3); }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex: none; }

.account { position: relative; }
.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--slate-soft); color: var(--text-2); font-size: 12px; font-weight: 600;
}
.avatar-btn:hover { border-color: var(--border-strong); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 6px;
}
.menu-head { display: grid; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head span { font-size: 12.5px; color: var(--text-3); }
.role-tag { justify-self: start; margin-top: 4px; font-size: 11px !important; font-weight: 500; color: var(--text-2) !important; background: var(--slate-soft); border-radius: 999px; padding: 1px 8px; }
.menu-item { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; }
.menu-item:hover { background: var(--surface-2); }

/* ------------------------------------------------------------------ tabs */

.tabs { max-width: 1440px; margin: 0 auto; padding: 0 24px; display: flex; gap: 22px; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 2px;
  border: 0; background: none; font-size: 13.5px; font-weight: 500; color: var(--text-3);
}
.tab:hover { color: var(--text); }
.tab[aria-selected='true'] { color: var(--text); }
.tab[aria-selected='true']::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tab-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--slate-soft); color: var(--text-2); font-size: 11px; font-weight: 600;
}
.tab-badge.is-overdue { background: var(--red-soft); color: var(--red); }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 500; font-size: 13.5px; white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-secondary.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a91f1f; }
.btn-ghost-danger { background: none; color: var(--red); padding: 0 8px; }
.btn-ghost-danger:hover { background: var(--red-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--text-2); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.link-btn:hover { color: var(--accent); text-decoration-color: currentColor; }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px;
  border: 0; background: none; color: var(--text-3);
}
.icon-btn:hover { background: var(--slate-soft); color: var(--text); }
.icon-btn-danger:hover { background: var(--red-soft); color: var(--red); }

/* --------------------------------------------------------------- controls */

.control {
  height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); min-width: 0; font-size: 13.5px;
}
.control:hover { border-color: #c5c1bc; }
.control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.control[aria-invalid='true'] { border-color: var(--red); }
.control-sm { height: 30px; font-size: 12.5px; }
.control-select {
  appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238f8a84' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
}
textarea.control { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
input[type='date'].control, input[type='datetime-local'].control { padding-right: 6px; }

.checkline { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.checkline input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* ---------------------------------------------------------------- page */

.page { max-width: 1440px; margin: 0 auto; padding: 20px 24px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.custom-range { display: inline-flex; align-items: center; gap: 6px; }
.range-label { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; padding-left: 4px; }
.range-label.is-error { color: var(--red); }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px; background: var(--slate-soft);
  border: 1px solid var(--border); border-radius: 9px;
}
.segmented button {
  height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: none;
  font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* ------------------------------------------------------------------ KPIs */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  display: grid; gap: 4px; text-align: left; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color 0.12s, background-color 0.12s;
}
.kpi:hover { border-color: var(--border-strong); }
.kpi.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.kpi-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi-label .icon { color: var(--text-3); }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-foot { font-size: 12px; color: var(--text-3); }
.kpi[data-kpi='meta'] .kpi-label .icon { color: var(--meta); }
.kpi[data-kpi='google'] .kpi-label .icon { color: var(--google); }
.kpi-accent .kpi-value, .kpi-accent .kpi-label .icon { color: var(--accent); }
body.is-loading .kpi-value { opacity: 0.55; transition: opacity 0.2s 0.15s; }

.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-static { cursor: default; }
.kpi-static:hover { border-color: var(--border); }
.kpi-danger .kpi-value, .kpi-danger .kpi-label .icon { color: var(--red); }

/* ---------------------------------------------------------------- panels */

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-title { font-size: 14px; font-weight: 600; }

.att-head {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 18px;
  background: none; border: 0; text-align: left; border-radius: var(--radius);
}
.att-head:hover { background: var(--surface-2); }
.att-head .chevron { margin-left: auto; color: var(--text-3); transition: transform 0.15s; }
.att-head[aria-expanded='false'] .chevron { transform: rotate(-90deg); }
.att-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--text-2); }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.att-stat.is-important { color: var(--amber); font-weight: 500; }
.att-stat.is-critical { color: var(--red); font-weight: 500; }
.att-body { border-top: 1px solid var(--border); padding: 8px 18px 12px; }
.att-single .att-note { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--text); font-size: 13.5px; }
.att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.att-item {
  width: 100%; display: grid; gap: 3px; text-align: left; padding: 8px 10px; margin: 0 -10px;
  width: calc(100% + 20px); border: 0; background: none; border-radius: 7px;
}
.att-item:hover { background: var(--surface-2); }
.att-title { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-note { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-meta { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.att-meta .icon { width: 13px; height: 13px; margin-right: -6px; }
.att-campaign { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.att-empty { font-size: 13px; color: var(--text-3); padding: 6px 0; }
.att-more { font-size: 12px; color: var(--text-3); padding: 6px 0 0; }
.overdue { color: var(--red); font-weight: 500; }

/* --------------------------------------------------------------- labels */

.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; margin-right: 8px; white-space: nowrap; }
.prio i { width: 7px; height: 7px; border-radius: 50%; }
.prio-important { color: var(--amber); }
.prio-important i { background: var(--amber-dot); }
.prio-critical { color: var(--red); }
.prio-critical i { background: var(--red-dot); }
.prio-normal { color: var(--text-2); }

.flag-on { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 500; font-size: 12px; }
.flag-chip { height: 22px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); }

.platform { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.platform-meta .icon { color: var(--meta); }
.platform-google .icon { color: var(--google); }

.person { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.avatar-sm {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--slate-soft); color: var(--text-2); font-size: 10px; font-weight: 600; flex: none;
}

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill-pending { background: var(--amber-soft); color: var(--amber); }
.pill-in-progress { background: var(--blue-soft); color: var(--blue); }
.pill-done { background: var(--green-soft); color: var(--green); }
.with-chip { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
  padding: 2px 8px; border-radius: 6px; background: var(--slate-soft); color: var(--text); font-size: 12.5px; font-weight: 500; }
.due-soon { color: var(--amber); font-weight: 500; }
.due-done { color: var(--green); }
.due-chip { font-size: 12.5px; }

/* ------------------------------------------------------------------- log */

.log-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; }
.log-head h2 { font-size: 15px; font-weight: 600; }
.log-head p { font-size: 12.5px; }
.log-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.live { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.live.is-on::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 3px #e3f5ec; }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .control { width: 300px; padding-left: 32px; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); white-space: nowrap;
  padding: 9px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 14px; }
.table tbody tr { cursor: pointer; transition: background-color 0.1s; }
.table tbody tr:hover, .table tbody tr:focus-visible { background: #fcfbfa; }
.table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.table tbody tr:last-child td { border-bottom: 0; }
.row-critical td:first-child { box-shadow: inset 2px 0 0 var(--red-dot); }
.row-important td:first-child { box-shadow: inset 2px 0 0 var(--amber-dot); }
.cell-main { display: block; color: var(--text); font-weight: 500; }
.cell-sub { display: flex; align-items: center; font-size: 12px; color: var(--text-3); margin-top: 1px; white-space: nowrap; }
.col-date { white-space: nowrap; width: 92px; }
.col-remarks { min-width: 280px; width: 60%; color: var(--text); }
.col-actions { width: 96px; }
.col-project { min-width: 220px; max-width: 360px; }
.col-project .cell-sub { display: block; white-space: nowrap; }
.col-due { white-space: nowrap; width: 130px; }
.col-actions-wide { width: 190px; }
.row-done .cell-main { color: var(--text-3); }
.row-actions .btn-sm .icon { width: 14px; height: 14px; }
.col-actions-wide .row-actions { opacity: 1; }
.cell-sub.overdue { color: var(--red); }
.cell-sub.due-soon { color: var(--amber); }
.cell-sub.due-done { color: var(--green); }
.clamp-1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.values { display: block; margin-top: 3px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: 0.35; transition: opacity 0.12s; }
tr:hover .row-actions, tr:focus-within .row-actions, .card-item .row-actions { opacity: 1; }

.cards { display: none; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.card-item { padding: 14px 16px; border-bottom: 1px solid var(--border); display: grid; gap: 5px; cursor: pointer; }
.card-item:last-child { border-bottom: 0; }
.ci-top { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ci-top .prio { margin-left: auto; margin-right: 0; }
.ci-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ci-cat { font-size: 12px; color: var(--text-3); }
.ci-desc { color: var(--text-2); font-size: 13px; }
.ci-foot { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin-top: 2px; }
.ci-foot .row-actions { margin-left: auto; }

.empty { padding: 48px 20px 52px; text-align: center; display: grid; gap: 6px; justify-items: center; border-top: 1px solid var(--border); }
.empty-title { font-weight: 600; font-size: 14px; }
.empty .muted { max-width: 380px; margin-bottom: 8px; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12.5px; }
.pager:empty { display: none; }
.pager-btns { display: inline-flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------- drawer */

.drawer-wrap { position: fixed; inset: 0; z-index: 50; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(28, 25, 23, 0.28); opacity: 0; transition: opacity 0.18s; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--surface); box-shadow: -12px 0 40px -12px rgba(0, 0, 0, 0.2);
  display: flex; flex-direction: column; transform: translateX(24px); opacity: 0;
  transition: transform 0.18s ease-out, opacity 0.18s ease-out; outline: none;
}
.drawer-wrap.open .drawer-overlay { opacity: 1; }
.drawer-wrap.open .drawer { transform: none; opacity: 1; }
.drawer-form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.drawer-head h2.platform { gap: 8px; }
.drawer-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; overflow-wrap: anywhere; }
.eyebrow { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; margin-bottom: 3px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.chips .prio { margin-right: 0; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--slate-soft); }
.chips .prio-important { background: var(--amber-soft); }
.chips .prio-critical { background: var(--red-soft); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 24px; display: grid; gap: 16px; align-content: start; }
.drawer-foot { border-top: 1px solid var(--border); padding: 12px 22px; background: var(--surface); }
.foot-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.kbd-hint { font-size: 12px; color: var(--text-3); margin-right: auto; }
.read-only-note { font-size: 12.5px; }

.auto-meta { font-size: 12.5px; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.auto-meta strong { color: var(--text-2); font-weight: 500; }

.field { display: grid; gap: 5px; min-width: 0; border: 0; margin: 0; padding: 0; }
.field > label, .field > legend, .field .label { font-size: 12.5px; font-weight: 500; color: var(--text-2); padding: 0; margin-bottom: 5px; }
.field > label { margin-bottom: 0; }
.req { color: var(--accent); }
.field select + input { margin-top: 6px; }
.field-error { display: none; font-size: 12px; color: var(--red); }
.field.has-error .field-error { display: block; }
.field.has-error .seg-group { border-color: var(--red); }
.form-error { font-size: 13px; color: var(--red); background: var(--red-soft); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 10px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.seg-group { display: flex; padding: 3px; gap: 2px; background: var(--slate-soft); border: 1px solid var(--border); border-radius: 9px; }
.seg { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; height: 30px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg-important input:checked + span { color: var(--amber); }
.seg-critical input:checked + span { color: var(--red); }

/* detail */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.dl-compact { gap: 8px 16px; }
.dl-row { min-width: 0; }
.dl-wide { grid-column: 1 / -1; }
.dl dt { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.dl dd { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.d-section { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.d-section.d-first { padding-top: 0; border-top: 0; }
.remarks-text { font-size: 14.5px; line-height: 1.6; }
.d-section h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.history li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; font-size: 13px; color: var(--text-2); }
.history em { font-style: normal; color: var(--text); background: var(--slate-soft); border-radius: 4px; padding: 0 4px; }
.history strong { color: var(--text); font-weight: 600; }
.history time { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.h-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); margin: 7px 0 0 2px; }
.history li:first-child .h-dot { background: var(--accent); }

/* ---------------------------------------------------------- confirm, toast */

.confirm-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(28, 25, 23, 0.32); display: grid; place-items: center; padding: 16px; }
.confirm { width: 100%; max-width: 400px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 20px; display: grid; gap: 8px; }
.confirm h3 { font-size: 15px; font-weight: 600; }
.confirm p { color: var(--text-2); font-size: 13.5px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  background: var(--text); color: #fff; font-size: 13px; font-weight: 500; padding: 9px 14px;
  border-radius: 8px; box-shadow: var(--shadow-pop); animation: toast-in 0.18s ease-out; max-width: min(520px, calc(100vw - 32px));
  transition: opacity 0.3s, transform 0.3s;
}
.toast-error { background: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search .control { width: 240px; }
}

@media (max-width: 760px) {
  .topbar-inner { padding: 12px 16px 6px; }
  .tabs { padding: 0 16px; }
  .kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpis-3 .kpi-label { font-size: 12px; }
  .brand-text p, .brand-rule { display: none; }
  .brand { gap: 10px; flex-direction: column; align-items: flex-start; }
  .brand-logo { height: 18px; }
  .brand-text h1 { font-size: 14px; }
  .page { padding: 14px 16px 40px; gap: 12px; }
  .filters, .filter-group { align-items: stretch; }
  .filter-group { width: 100%; }
  .filter-group > .control-select { flex: 1; }
  .range-label { width: 100%; padding-left: 0; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 0 6px; }
  .custom-range { width: 100%; }
  .custom-range .control { flex: 1; }
  .popover { left: 0; right: auto; width: min(300px, calc(100vw - 32px)); }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 24px; }
  .kpi-foot { display: none; }
  .att-head { flex-wrap: wrap; padding: 12px 14px; }
  .att-body { padding: 6px 14px 10px; }
  .log-head { padding: 14px 14px 10px; }
  .log-tools, .search, .search .control { width: 100%; }
  .table-wrap { display: none; }
  .cards { display: block; }
  .pager { padding: 12px 14px; }
  .drawer { width: 100%; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .dl { grid-template-columns: 1fr; }
  .kbd-hint { display: none; }
}

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