:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #dbe3ef;
  --line-strong: #c5d0df;
  --text: #162033;
  --muted: #65758b;
  --muted-2: #8795a8;
  --nav: #111827;
  --nav-soft: #1f2937;
  --teal: #0f9f8f;
  --blue: #286de8;
  --amber: #c47b12;
  --rose: #d33f5f;
  --green-bg: #e9f8f3;
  --green-text: #08745f;
  --blue-bg: #eef5ff;
  --blue-text: #245fd6;
  --amber-bg: #fff6df;
  --amber-text: #9b5d00;
  --rose-bg: #fff0f3;
  --rose-text: #b22b4a;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(219, 227, 239, 0.72), rgba(244, 247, 251, 0.08) 320px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: linear-gradient(180deg, var(--nav), #0b1020);
  color: #eef4ff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #16a085, #2f80ed);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: #aab8cf;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: #d8e2f1;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.nav-icon {
  width: 26px;
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  opacity: 0.72;
}

.nav-badge {
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e43f5a;
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
}

.nav-badge[hidden] {
  display: none;
}

.tool-box {
  margin-top: auto;
  padding: 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tool-title {
  color: #aab8cf;
  font-size: 12px;
  margin-bottom: 10px;
}

.tool-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.main {
  padding: 26px 28px 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.registration-alert {
  margin: -8px 0 22px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #f1b6c0;
  border-left: 5px solid #e43f5a;
  border-radius: 8px;
  background: #fff4f6;
  box-shadow: 0 12px 32px rgba(211, 63, 95, 0.12);
}

.registration-alert[hidden] {
  display: none;
}

.registration-alert strong {
  display: block;
  margin-bottom: 3px;
  color: #981d36;
  font-size: 15px;
}

.registration-alert span {
  color: #6f3140;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  width: 360px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-icon {
  color: var(--muted-2);
  font-size: 18px;
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.primary-btn,
.ghost-btn {
  height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
  border: 1px solid transparent;
}

.primary-btn {
  background: #1967d2;
  color: white;
}

.primary-btn:hover {
  background: #1456b0;
}

.ghost-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.wide {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  min-height: 136px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.accent-teal { --accent: var(--teal); }
.accent-blue { --accent: var(--blue); }
.accent-amber { --accent: var(--amber); }
.accent-rose { --accent: var(--rose); }

.metric-label {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: 34px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.split-layout,
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
  margin-bottom: 18px;
}

.workbench {
  grid-template-columns: 360px minmax(0, 1fr);
}

#users .workbench {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-head {
  min-height: 68px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.panel-head select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
}

.performance-list,
.activity-list,
.release-list {
  padding: 12px 18px 18px;
}

.performance-row {
  display: grid;
  grid-template-columns: 190px minmax(140px, 1fr) 84px;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.performance-row:last-child,
.activity-item:last-child {
  border-bottom: 0;
}

.person-name {
  font-weight: 800;
}

.person-role {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e8eef6;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a085, #286de8);
}

.progress-value {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.activity-item {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.activity-time {
  color: var(--muted);
  font-weight: 800;
}

.activity-text strong {
  color: var(--text);
}

.activity-text span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.tool-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.tool-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.tool-status strong {
  display: block;
  margin-bottom: 7px;
}

.tool-status span {
  color: var(--muted);
  font-size: 13px;
}

.form-panel {
  align-self: start;
}

.form-grid {
  display: grid;
  gap: 12px;
  padding: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--text);
  outline: 0;
}

input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea {
  padding: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #286de8;
  box-shadow: 0 0 0 3px rgba(40, 109, 232, 0.14);
}

.span-all {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

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

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}

td {
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}

.machine-status-cell {
  display: grid;
  gap: 5px;
  align-items: start;
}

.machine-status-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.connect-token {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 260px;
  padding: 0 8px;
  border-radius: 7px;
  background: #eef2f7;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.token-cell {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.token-copy-btn {
  width: fit-content;
}

.mini-action-btn {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.mini-action-btn:hover {
  border-color: #286de8;
  color: #245fd6;
  background: #eef5ff;
}

.mini-action-btn.danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff5f5;
}

.mini-action-btn.danger:hover {
  border-color: #f87171;
  color: #991b1b;
  background: #fee2e2;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 150px;
}

.request-list {
  display: grid;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.request-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.request-card strong {
  display: block;
  margin-bottom: 4px;
}

.request-meta {
  color: var(--muted);
  font-size: 12px;
}

.status-green {
  color: var(--green-text);
  background: var(--green-bg);
}

.status-blue {
  color: var(--blue-text);
  background: var(--blue-bg);
}

.status-amber {
  color: var(--amber-text);
  background: var(--amber-bg);
}

.status-rose {
  color: var(--rose-text);
  background: var(--rose-bg);
}

.machine-online {
  color: #854d0e;
  background: #fef3c7;
  border: 1px solid #facc15;
}

.machine-offline {
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.segment {
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.segment.active {
  color: var(--text);
  background: white;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  padding: 18px;
  align-items: start;
  overflow-x: auto;
}

.kanban-column {
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--column-bg, #f8fafc);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.kanban-column::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--column-accent, #94a3b8);
}

.kanban-todo {
  --column-accent: #64748b;
  --column-bg: #f8fafc;
  --column-head: #eef2f7;
  --column-soft: #e2e8f0;
}

.kanban-doing {
  --column-accent: #286de8;
  --column-bg: #f3f8ff;
  --column-head: #e7f0ff;
  --column-soft: #bdd7ff;
}

.kanban-support {
  --column-accent: #d98013;
  --column-bg: #fff9ed;
  --column-head: #fff0cf;
  --column-soft: #ffd991;
}

.kanban-done {
  --column-accent: #0f9f8f;
  --column-bg: #f0fbf8;
  --column-head: #dcf7f1;
  --column-soft: #a7e8dc;
}

.kanban-column.drag-over {
  border-color: var(--column-accent, #286de8);
  background: color-mix(in srgb, var(--column-bg, #eef5ff) 72%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--column-accent, #286de8) 18%, transparent);
}

.kanban-column-head {
  min-height: 54px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--column-head, #f8fafc);
}

.kanban-column-head strong {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kanban-column-head strong::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--column-accent, #94a3b8);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--column-accent, #94a3b8) 14%, transparent);
}

.kanban-column-head span {
  min-width: 26px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--column-soft, var(--line));
  color: var(--column-accent, var(--muted));
  font-size: 12px;
  font-weight: 900;
}

.kanban-column-body {
  display: grid;
  gap: 10px;
  padding: 10px;
  align-content: start;
  flex: 1;
}

.kanban-empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--column-soft, var(--line-strong));
  border-radius: 8px;
  color: color-mix(in srgb, var(--column-accent, #64748b) 62%, var(--muted));
  background: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  text-align: center;
  padding: 12px;
}

.task-card,
.page-card,
.release-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.task-card {
  padding: 14px;
  background: white;
  cursor: grab;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  position: relative;
  overflow: hidden;
}

.task-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--priority-accent, #94a3b8);
}

.priority-high {
  --priority-accent: #d33f5f;
  --priority-bg: #fff0f3;
  --priority-text: #b22b4a;
}

.priority-medium {
  --priority-accent: #d98013;
  --priority-bg: #fff6df;
  --priority-text: #9b5d00;
}

.priority-low {
  --priority-accent: #0f9f8f;
  --priority-bg: #e9f8f3;
  --priority-text: #08745f;
}

.task-card:hover {
  border-color: color-mix(in srgb, var(--priority-accent, #94a3b8) 42%, var(--line-strong));
  box-shadow: 0 12px 26px color-mix(in srgb, var(--priority-accent, #94a3b8) 16%, transparent);
  transform: translateY(-1px);
}

.task-card.dragging {
  opacity: 0.58;
  cursor: grabbing;
  box-shadow: none;
}

.task-card h3,
.page-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.35;
}

.task-card .status-pill:first-child {
  background: var(--priority-bg, var(--amber-bg));
  color: var(--priority-text, var(--amber-text));
}

.task-meta,
.page-meta,
.release-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.checklist {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.checklist li::before {
  content: "✓";
  margin-right: 8px;
  color: var(--teal);
  font-weight: 900;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.page-filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-filterbar select {
  width: 190px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
}

.page-monitor-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.mini-metric {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mini-bg, #f8fafc);
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.mini-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--mini-accent, #64748b);
}

.mini-metric span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.mini-metric strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
  line-height: 1;
}

.mini-metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.tone-page {
  --mini-accent: #0f9f8f;
  --mini-bg: #f0fbf8;
}

.tone-view {
  --mini-accent: #286de8;
  --mini-bg: #eef5ff;
}

.tone-post {
  --mini-accent: #d98013;
  --mini-bg: #fff6df;
}

.tone-alert {
  --mini-accent: #d33f5f;
  --mini-bg: #fff0f3;
}

.view-delta {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
}

.delta-up {
  color: var(--green-text);
  background: var(--green-bg);
}

.delta-down {
  color: var(--rose-text);
  background: var(--rose-bg);
}

.delta-flat {
  color: var(--muted);
  background: #eef2f7;
}

.page-card {
  padding: 16px;
}

.page-stat {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.page-stat div {
  padding: 10px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
}

.page-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.page-stat strong {
  font-size: 20px;
}

.release-card {
  padding: 15px;
  margin-bottom: 12px;
}

.release-card h3 {
  margin: 0;
  font-size: 18px;
}

.release-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  min-width: 260px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #111827;
  color: white;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .metric-grid,
  .tool-status-grid,
  .page-monitor-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout,
  .workbench {
    grid-template-columns: 1fr;
  }

  .page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 16px;
    gap: 14px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav-item {
    width: auto;
    min-width: 138px;
    flex: 0 0 auto;
  }

  .tool-box {
    margin-top: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .tool-title {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .tool-row {
    display: block;
    border-top: 0;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
  }

  .tool-row strong {
    display: block;
    margin-top: 4px;
  }

  .main {
    padding: 18px 14px 34px;
  }

  .topbar {
    display: grid;
    align-items: start;
    gap: 14px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    width: 100%;
  }

  .search-wrap {
    width: 100%;
  }

  .metric-grid,
  .tool-status-grid,
  .page-monitor-summary,
  .page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    grid-template-columns: repeat(4, minmax(220px, 260px));
  }

  .kanban-column {
    min-height: 420px;
  }

  .panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .page-filterbar {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .page-filterbar select {
    width: 100%;
  }

  table {
    min-width: 760px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .registration-alert {
    align-items: stretch;
    flex-direction: column;
  }

  .registration-alert .primary-btn {
    width: 100%;
  }

  .sidebar {
    padding: 14px 12px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-title {
    font-size: 15px;
  }

  .nav-item {
    min-width: 126px;
    height: 40px;
    padding: 0 10px;
  }

  .tool-box {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 16px 10px 30px;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 15px;
  }

  .topbar-actions {
    grid-template-columns: 1fr 1fr;
  }

  .search-wrap {
    grid-column: 1 / -1;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
    padding: 0 10px;
  }

  .metric-grid,
  .tool-status-grid,
  .page-monitor-summary,
  .page-grid,
  .task-board {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .mini-metric {
    min-height: 104px;
  }

  .metric-card strong,
  .mini-metric strong {
    font-size: 27px;
  }

  .performance-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .progress-value {
    text-align: left;
  }

  .activity-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .segment {
    padding: 0 6px;
  }

  .kanban-board {
    grid-template-columns: repeat(4, minmax(210px, 82vw));
    padding: 12px;
  }

  .page-filterbar {
    grid-template-columns: 1fr;
  }

  .panel-head {
    padding: 14px;
  }

  .form-grid,
  .page-monitor-summary,
  .tool-status-grid,
  .page-grid {
    padding: 14px;
  }

  th,
  td {
    padding: 11px 12px;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: 12px;
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .mini-metric,
  .panel,
  .task-card,
  .page-card,
  .release-card {
    border-radius: 7px;
  }
}
