:root {
  color-scheme: light;
  --bg: #f8fafc;
  --card: #ffffff;
  --card-muted: #f8fafc;
  --card-glass: rgba(255, 255, 255, 0.78);
  --ink: #111827;
  --ink-soft: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 12px 36px rgba(15, 23, 42, 0.1);
  --accent: #14b8a6;
  --accent-strong: #0d9488;
  --accent-soft: rgba(20, 184, 166, 0.12);
  --success-bg: #d1fae5;
  --success-text: #047857;
  --warning-bg: #fef3c7;
  --warning-text: #b45309;
  --danger-bg: #fee2e2;
  --danger-text: #b91c1c;
  --radius-field: 12px;
  --radius-card-sm: 16px;
  --radius-card: 20px;
  --radius-card-lg: 24px;
  --control-height: 42px;
  --control-height-sm: 36px;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 16%, rgba(20, 184, 166, 0.14), transparent 28%),
    radial-gradient(circle at 84% 10%, rgba(6, 182, 212, 0.1), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(20, 184, 166, 0.08), transparent 34%);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(20, 184, 166, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 184, 166, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  opacity: 0.7;
}

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

button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

input:not([type="checkbox"]),
select,
textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: rgba(255, 255, 255, 0.96);
  min-height: var(--control-height);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 10px 6px;
}

select::-ms-expand {
  display: none;
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  border-color: rgba(20, 184, 166, 0.7);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

textarea {
  resize: vertical;
  min-height: 96px;
}

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

th,
td {
  text-align: left;
}

code,
.code-block {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.is-hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.text-btn,
.nav-item,
.login-submit,
.modal-close {
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.nav-item,
.login-submit,
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-field);
  min-height: var(--control-height-sm);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
}

.primary-btn,
.login-submit {
  color: #ffffff;
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  box-shadow: 0 10px 24px rgba(20, 184, 166, 0.24);
}

.primary-btn:hover,
.login-submit:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.danger-btn:hover,
.nav-item:hover,
.modal-close:hover,
.text-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.ghost-btn,
.modal-close {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(229, 231, 235, 0.96);
}

.danger-btn {
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.22);
}

.text-btn {
  padding: 0;
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  align-content: start;
}

.field > input,
.field > select,
.field > textarea {
  width: 100%;
  align-self: start;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.compact-field .field-label {
  font-size: 12px;
}

.grow {
  flex: 1 1 240px;
}

.inline-message {
  min-height: 18px;
  margin: 0;
  font-size: 12px;
  color: var(--danger-text);
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(20, 184, 166, 0.16), transparent 28%),
    radial-gradient(circle at 84% 20%, rgba(6, 182, 212, 0.14), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 42%);
}

.login-card {
  position: relative;
  width: min(460px, 100%);
  padding: 32px 30px;
  border-radius: var(--radius-card-lg);
  background: var(--card-glass);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  animation: rise-in 0.42s ease;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-brand h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.08;
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-brand p:last-child {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.login-form {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-soft);
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.login-note {
  margin-top: 18px;
  border-top: 1px solid rgba(229, 231, 235, 0.88);
  padding-top: 14px;
}

.login-note p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid rgba(229, 231, 235, 0.95);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.04);
  color: var(--ink);
  backdrop-filter: blur(14px);
  min-height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(6, 182, 212, 0.07));
  border: 1px solid rgba(20, 184, 166, 0.14);
  cursor: pointer;
}

.sidebar-brand:hover {
  box-shadow: var(--shadow-soft);
}

.sidebar-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-card-sm);
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 24px rgba(20, 184, 166, 0.22);
}

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

.sidebar-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  align-content: start;
}

.nav-item {
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  color: #4b5563;
  border: 1px solid transparent;
  background: transparent;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(243, 244, 246, 0.92);
  border-color: rgba(229, 231, 235, 0.96);
}

.nav-item.is-active {
  color: var(--accent-strong);
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.22);
}

.sidebar-meta {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid rgba(229, 231, 235, 0.88);
}

.meta-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
}

.meta-value {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  word-break: break-all;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 0 24px 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  margin: 0 -24px;
  padding: 0 24px;
  background: rgba(248, 250, 252, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.72);
}

.topbar-label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
}

.page-title {
  margin: 0;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.15;
}

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

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-height-sm);
  padding: 0 12px;
  border-radius: var(--radius-field);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  color: var(--ink-soft);
}

.account-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #13a35e 0%, #0f8050 100%);
}

.banner {
  padding: 12px 14px;
  border-radius: var(--radius-field);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
}

.banner.is-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(16, 185, 129, 0.16);
}

.banner.is-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(245, 158, 11, 0.14);
}

.banner.is-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(239, 68, 68, 0.14);
}

.center-copy-notice {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  pointer-events: none;
}

.center-copy-notice__card {
  width: min(420px, calc(100vw - 32px));
  padding: 18px 20px;
  border-radius: var(--radius-card-lg);
  background: rgba(17, 26, 40, 0.96);
  color: #f7fbff;
  border: 1px solid rgba(80, 208, 154, 0.26);
  box-shadow: 0 24px 64px rgba(10, 18, 30, 0.36);
  text-align: center;
  animation: center-copy-notice-in 0.18s ease-out;
}

.center-copy-notice__title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.center-copy-notice__text {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(247, 251, 255, 0.82);
}

@keyframes center-copy-notice-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.page-view {
  display: grid;
  gap: 14px;
  align-content: start;
}

.view-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0;
}

.hero-compact {
  padding-top: 4px;
  padding-bottom: 0;
}

.view-hero h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1.1;
}

.view-hero p:last-child {
  display: none;
}

.dashboard-hero {
  align-items: flex-end;
}

.dashboard-hero .view-description {
  display: block;
  max-width: 720px;
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.hero-actions,
.modal-actions,
.danger-actions,
.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-toolbar {
  display: grid;
  gap: 12px;
  grid-template-columns: 220px minmax(260px, 1fr);
  align-items: end;
  padding: 12px;
  border-radius: var(--radius-card-sm);
  background: rgba(248, 250, 252, 0.86);
  border: 1px solid rgba(229, 231, 235, 0.9);
}

.account-group-table th,
.account-group-table td {
  white-space: nowrap;
}

.account-group-table td:nth-child(3),
.account-group-table td:nth-child(6) {
  white-space: normal;
}

.group-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-chip {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
}

.group-chip.is-disabled {
  background: #fee2e2;
  color: #991b1b;
}

.group-chip.is-empty {
  background: #f1f5f9;
  color: var(--ink-soft);
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.metric-card {
  padding: 16px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(229, 231, 235, 0.8);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.metric-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.metric-value {
  margin-top: 6px;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

.metric-subvalue {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.dashboard-stat-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-stat-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(229, 231, 235, 0.84);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.dashboard-stat-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  flex: none;
}

.dashboard-stat-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-stat-icon.tone-blue {
  background: #dbeafe;
  color: #2563eb;
}

.dashboard-stat-icon.tone-green {
  background: #dcfce7;
  color: #16a34a;
}

.dashboard-stat-icon.tone-rose {
  background: #ffe4e6;
  color: #e11d48;
}

.dashboard-stat-icon.tone-amber {
  background: #fef3c7;
  color: #d97706;
}

.dashboard-stat-icon.tone-violet {
  background: #ede9fe;
  color: #7c3aed;
}

.dashboard-stat-icon.tone-indigo {
  background: #e0e7ff;
  color: #4f46e5;
}

.dashboard-stat-icon.tone-teal {
  background: #ccfbf1;
  color: #0f766e;
}

.dashboard-stat-icon.tone-orange {
  background: #ffedd5;
  color: #ea580c;
}

.dashboard-stat-copy {
  min-width: 0;
}

.dashboard-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.dashboard-stat-value {
  margin-top: 6px;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  color: var(--ink);
}

.dashboard-stat-subvalue {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.split-grid {
  display: grid;
  gap: 14px;
  align-items: start;
  grid-template-columns: 1.05fr 0.95fr;
}

.dashboard-main-grid-single {
  grid-template-columns: 1fr;
}

.panel {
  padding: 18px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(229, 231, 235, 0.8);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
}

.panel-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.panel-head p {
  display: none;
}

.panel-caption {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.panel-head-inline {
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.template-sort-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.template-sort-hint::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.1);
}

.panel-body,
.template-grid,
.preview-list,
.detail-summary-grid,
.three-col-grid,
.two-col-grid,
.form-grid {
  display: grid;
  gap: 12px;
  align-items: start;
}

.template-grid {
  grid-template-columns: repeat(auto-fit, minmax(216px, 1fr));
  gap: 10px;
}

.template-card,
.summary-card,
.preview-card,
.group-card,
.recent-key-card {
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.template-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  position: relative;
  min-width: 0;
  cursor: grab;
  user-select: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    background-color 0.18s ease,
    opacity 0.18s ease;
}

.template-card:hover {
  border-color: rgba(20, 184, 166, 0.26);
  box-shadow: var(--shadow-hover);
}

.template-grid.is-sort-saving .template-card {
  cursor: progress;
}

.template-card[draggable="false"] {
  cursor: default;
}

.template-card.is-dragging {
  opacity: 0.42;
  transform: scale(0.985) rotate(0.8deg);
}

.template-card.is-drop-target {
  border-color: rgba(20, 184, 166, 0.54);
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
  box-shadow:
    0 0 0 2px rgba(20, 184, 166, 0.12),
    var(--shadow-hover);
}

.template-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.template-card-title {
  min-width: 0;
}

.template-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.template-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px dashed rgba(20, 184, 166, 0.24);
  background: rgba(20, 184, 166, 0.08);
  color: var(--accent-strong);
  flex: none;
}

.template-drag-handle::before {
  content: "";
  width: 10px;
  height: 10px;
  background-image: radial-gradient(currentColor 1.2px, transparent 1.2px);
  background-size: 5px 5px;
  background-position: center;
}

.template-sort-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.08);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.template-card h4,
.group-card h4,
.recent-key-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-card-note {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted-text {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.4;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

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

.status-disabled,
.status-inactive {
  background: var(--danger-bg);
  color: var(--danger-text);
}

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

.status-default {
  background: rgba(107, 114, 128, 0.12);
  color: var(--ink-soft);
}

.template-rule-list,
.meta-list {
  display: grid;
  gap: 5px;
}

.template-rule-item,
.preview-item {
  padding: 8px 10px;
  border-radius: var(--radius-field);
  background: var(--card-muted);
  border: 1px solid rgba(229, 231, 235, 0.88);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
}

.preview-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 8px;
}

.template-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.template-card-actions .ghost-btn,
.template-card-actions .danger-btn {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.selection-summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.08);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.filter-bar {
  margin-bottom: 12px;
  display: grid;
  gap: 10px 12px;
  grid-template-columns: minmax(300px, 520px) repeat(3, minmax(120px, 140px)) auto;
  justify-content: start;
  align-items: end;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(229, 231, 235, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
}

.data-table th {
  padding: 14px 14px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: #f8fafc;
  border-bottom: 1px solid rgba(229, 231, 235, 0.96);
}

.data-table td {
  padding: 14px;
  border-top: 1px solid rgba(243, 244, 246, 1);
  vertical-align: top;
  font-size: 13px;
}

.data-table tbody tr:hover {
  background: rgba(248, 250, 252, 0.92);
}

.data-table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.select-column-head,
.key-select-cell {
  width: 46px;
  min-width: 46px;
  text-align: center;
}

.table-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.table-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.data-table tbody tr.is-selected {
  background: rgba(20, 184, 166, 0.08);
}

.key-column-head {
  width: 720px;
  min-width: 720px;
}

.actions-column-head {
  width: 172px;
  min-width: 172px;
}

.key-primary-cell {
  width: 720px;
  min-width: 720px;
}

.key-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.key-cell-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.key-cell-value {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.key-cell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.table-inline-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 10px;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 13px;
}

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

.three-col-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-col-grid,
.detail-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card,
.preview-card,
.group-card,
.recent-key-card {
  padding: 14px;
}

.summary-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.summary-value {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 800;
  word-break: break-all;
}

.summary-subvalue {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
}

.code-block {
  padding: 10px 12px;
  border-radius: var(--radius-field);
  background: #111827;
  color: #f9fafb;
  font-size: 12px;
}

.group-card p,
.recent-key-card p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.dashboard-list-card,
.dashboard-summary-card {
  padding: 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.dashboard-list-head,
.dashboard-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-list-title,
.dashboard-summary-head h4 {
  min-width: 0;
}

.dashboard-list-title h4,
.dashboard-summary-head h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-list-kicker {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  word-break: break-all;
}

.dashboard-list-meta,
.dashboard-summary-line,
.dashboard-summary-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.dashboard-summary-note {
  padding-top: 8px;
  border-top: 1px dashed rgba(209, 213, 219, 0.92);
}

.dashboard-template-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.empty-state,
.loading-state {
  min-height: 64px;
  padding: 16px;
  border-radius: var(--radius-card-sm);
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  display: grid;
  place-items: center;
}

.empty-state {
  border: 1px dashed rgba(209, 213, 219, 0.96);
  background: rgba(248, 250, 252, 0.8);
}

.loading-state {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(6, 182, 212, 0.06));
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 12px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(10px);
}

.modal-dialog {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
  border-radius: var(--radius-card-lg);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(229, 231, 235, 0.92);
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.18);
}

.modal-dialog-wide {
  width: min(1080px, 100%);
}

.key-detail-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1160px, calc(100vw - 32px));
  overflow: hidden;
}

.key-detail-dialog .modal-body {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.key-detail-dialog .summary-card {
  padding: 16px;
  min-width: 0;
}

.summary-mini-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

#detail-copy-key-button {
  grid-area: copy;
  margin-top: -2px;
  justify-self: start;
}

.detail-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  align-items: start;
  min-width: 0;
}

.detail-sidebar,
.detail-main,
.detail-overview-card,
.detail-section-card,
.detail-editor {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.detail-sidebar {
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  grid-template-areas:
    "head facts"
    "key facts"
    "copy facts";
  align-items: start;
}

.detail-sidebar-head,
.detail-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.detail-sidebar-head {
  grid-area: head;
  align-items: center;
}

.detail-sidebar > .detail-fact-grid {
  grid-area: facts;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-sidebar > .detail-fact-grid > .detail-fact-grid-tight {
  grid-column: 1 / -1;
}

.detail-key-value.code-block {
  grid-area: key;
  margin-top: 0;
  min-height: 56px;
  padding: 12px 14px;
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 16px;
  background: #f3f6fb;
  color: #182033;
  border: 1px solid rgba(209, 213, 219, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-family: Consolas, "SFMono-Regular", Menlo, Monaco, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
  overflow: hidden;
}

.detail-fact-grid {
  display: grid;
  gap: 10px;
}

.detail-fact-grid-tight {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-fact-card,
.detail-status-card {
  padding: 12px;
  border-radius: 14px;
  background: var(--card-muted);
  border: 1px solid rgba(229, 231, 235, 0.92);
}

.detail-fact-value,
.detail-status-value {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
  min-width: 0;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.detail-summary-value {
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.detail-status-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-section-head h4 {
  margin: 0;
  font-size: 16px;
}

.detail-section-head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.detail-control-grid {
  grid-template-columns: 220px 180px;
}

.detail-maintenance-card {
  gap: 12px;
}

.detail-action-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#create-key-modal .create-key-dialog {
  display: grid;
  grid-template-rows: auto auto;
  width: min(1080px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
}

#create-key-modal .modal-head {
  padding: 14px 16px 0;
}

#create-key-modal .modal-body {
  min-height: 0;
  overflow: visible;
  padding: 14px 16px 12px;
}

#create-key-form {
  min-height: 0;
  grid-template-rows: auto auto;
  align-content: start;
}

#create-key-modal .create-key-scroll-area {
  min-height: 0;
  overflow: visible;
  display: grid;
  gap: 10px;
  align-content: start;
}

#create-key-modal .modal-actions {
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(229, 231, 235, 0.88);
  background: rgba(255, 255, 255, 0.94);
}

#create-key-modal .create-key-preview-grid {
  align-items: start;
}

#create-key-modal .field {
  gap: 4px;
}

#create-key-modal .field-label {
  font-size: 11px;
}

#create-key-modal #create-ip-whitelist,
#create-key-modal #create-ip-blacklist {
  min-height: 96px;
}

#create-key-modal .preview-card {
  min-height: 0;
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
}

#create-key-modal .preview-title {
  margin-bottom: 6px;
}

#create-key-modal #create-package-preview,
#create-key-modal #create-group-preview {
  min-height: 0;
  overflow: visible;
  align-content: start;
}

#create-key-modal .preview-list {
  gap: 8px;
}

#create-key-modal .preview-item {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.32;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.08;
}

.modal-body {
  padding: 18px;
}

.danger-zone {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.98), rgba(255, 251, 235, 0.94));
  border: 1px solid rgba(248, 113, 113, 0.16);
  display: grid;
  gap: 10px;
}

.key-detail-dialog .danger-zone {
  margin-top: 0;
}

.key-detail-dialog .modal-actions {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(229, 231, 235, 0.88);
}

.danger-zone h4 {
  margin: 0;
  font-size: 16px;
}

.danger-zone p {
  display: none;
}

.quota-emphasis {
  font-weight: 800;
  color: var(--ink);
}

#dashboard-group-summary,
#template-list {
  align-content: start;
}

#key-table-body .empty-state,
#key-table-body .loading-state {
  min-height: 96px;
}

#create-ip-whitelist,
#create-ip-blacklist,
#detail-ip-whitelist,
#detail-ip-blacklist {
  min-height: 92px;
}

#template-notes,
#detail-notes {
  min-height: 72px;
}

@media (max-width: 1240px) {
  .split-grid,
  .filter-bar,
  .bulk-toolbar,
  .detail-layout,
  .detail-fact-grid-tight,
  .detail-status-grid,
  .detail-action-grid,
  .detail-control-grid,
  .three-col-grid,
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1240px) {
  .key-detail-dialog {
    width: min(980px, calc(100vw - 24px));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .detail-sidebar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "key"
      "copy"
      "facts";
  }

  .detail-sidebar > .detail-fact-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    border-right: 0;
    border-bottom: 1px solid rgba(229, 231, 235, 0.92);
    box-shadow: none;
    min-height: auto;
  }

  .detail-sidebar-head,
  .detail-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace {
    padding: 0 20px 20px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    margin: 0 -20px;
    padding: 12px 20px;
  }
}

@media (max-width: 720px) {
  .login-card,
  .panel,
  .view-hero,
  .modal-body,
  .modal-head {
    padding-left: 16px;
    padding-right: 16px;
  }

  .login-card {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .template-sort-hint {
    width: 100%;
    justify-content: flex-start;
    white-space: normal;
  }

  .panel-tools {
    width: 100%;
  }

  .table-footer,
  .modal-actions,
  .danger-actions,
  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

.accounts-bulk-note {
  grid-template-columns: 1fr;
  align-items: start;
}

.accounts-bulk-note p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.account-bulk-dialog {
  width: min(980px, calc(100vw - 32px));
}

.account-bulk-form {
  display: grid;
  gap: 14px;
}

.bulk-edit-alert {
  padding: 12px 14px;
  border-radius: var(--radius-card-sm);
  border: 1px solid rgba(20, 184, 166, 0.22);
  background: rgba(20, 184, 166, 0.08);
  color: #0f766e;
}

.bulk-edit-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bulk-edit-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-card-sm);
  border: 1px solid rgba(229, 231, 235, 0.92);
  background: rgba(248, 250, 252, 0.76);
}

.bulk-edit-card-wide {
  grid-column: 1 / -1;
}

.bulk-edit-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.bulk-edit-card input:not([type="checkbox"]),
.bulk-edit-card select,
.bulk-edit-card textarea {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}

.bulk-edit-card input:disabled,
.bulk-edit-card select:disabled,
.bulk-edit-card textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.field-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

@media (max-width: 760px) {
  .bulk-edit-grid {
    grid-template-columns: 1fr;
  }
}

.account-bulk-dialog {
  width: min(900px, calc(100vw - 28px));
}

.account-bulk-dialog .modal-head {
  border-bottom: 1px solid var(--border);
}

.bulk-group-check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  max-height: 150px;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: #fff;
}

.bulk-group-check-list.is-disabled {
  opacity: 0.55;
}

.bulk-group-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  cursor: pointer;
  color: var(--ink);
}

.bulk-group-check input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.bulk-group-name {
  min-width: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.08);
  color: #047857;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-group-name em {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(4, 120, 87, 0.14);
  font-style: normal;
  font-size: 11px;
}

.bulk-group-meta {
  color: var(--ink-soft);
  font-size: 12px;
}

.compact-empty {
  min-height: 48px;
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .bulk-group-check-list {
    grid-template-columns: 1fr;
  }
}

.account-bulk-dialog .modal-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
}

@media (max-width: 760px) {
  :root {
    --radius-card: 16px;
    --radius-card-lg: 18px;
    --radius-field: 11px;
    --control-height: 44px;
    --control-height-sm: 40px;
  }

  html,
  body {
    overflow-x: hidden;
  }

  body {
    font-size: 13px;
  }

  body::after {
    background-size: 40px 40px;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .danger-btn,
  .nav-item,
  .login-submit,
  .modal-close {
    min-height: 44px;
    padding: 0 14px;
  }

  input:not([type="checkbox"]),
  select,
  textarea {
    width: 100%;
    font-size: 16px;
  }

  .login-shell {
    padding: 12px;
    align-items: stretch;
  }

  .login-card {
    width: 100%;
    margin: auto 0;
    border-radius: 20px;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: 8px 10px calc(8px + env(safe-area-inset-top, 0px));
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
    border-right: 0;
    border-bottom: 1px solid rgba(229, 231, 235, 0.92);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  }

  .sidebar-brand {
    flex: 0 0 auto;
    padding: 4px;
    border-radius: 14px;
  }

  .sidebar-brand > div:not(.sidebar-mark),
  .sidebar-meta {
    display: none;
  }

  .sidebar-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 14px;
  }

  .sidebar-nav {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .workspace {
    gap: 12px;
    padding: 0 10px calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    position: sticky;
    top: calc(56px + env(safe-area-inset-top, 0px));
    z-index: 30;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    margin: 0 -10px;
    padding: 10px;
    background: rgba(248, 250, 252, 0.94);
  }

  .topbar-label,
  .account-chip {
    display: none;
  }

  .page-title {
    font-size: 20px;
  }

  .topbar-actions {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .topbar-actions .secondary-btn,
  .topbar-actions .ghost-btn {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .banner {
    padding: 10px 12px;
    border-radius: 14px;
  }

  .page-view {
    gap: 10px;
  }

  .view-hero,
  .panel {
    border-radius: 16px;
  }

  .view-hero {
    padding: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(229, 231, 235, 0.78);
    box-shadow: var(--shadow-soft);
  }

  .view-hero h1 {
    font-size: 24px;
  }

  .dashboard-hero .view-description {
    margin-top: 6px;
    font-size: 13px;
  }

  .dashboard-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-stat-card {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .dashboard-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .dashboard-stat-icon svg {
    width: 20px;
    height: 20px;
  }

  .dashboard-stat-value {
    font-size: 22px;
  }

  .dashboard-stat-subvalue,
  .panel-caption,
  .accounts-bulk-note p {
    font-size: 12px;
  }

  .panel {
    padding: 12px;
  }

  .panel-head,
  .panel-head-inline {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .panel-tools {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .panel-tools .primary-btn,
  .panel-tools .danger-btn,
  .panel-tools .secondary-btn,
  .panel-tools .ghost-btn,
  .selection-summary {
    width: 100%;
  }

  .selection-summary {
    justify-content: center;
    min-height: 34px;
  }

  .filter-bar,
  .accounts-filter-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .compact-field,
  .grow {
    width: 100%;
  }

  .filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .filter-actions .secondary-btn,
  .filter-actions .ghost-btn {
    width: 100%;
  }

  .bulk-toolbar {
    padding: 10px;
  }

  .template-grid,
  .dashboard-template-grid {
    grid-template-columns: 1fr;
  }

  .template-card {
    cursor: default;
  }

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

  .template-card-actions .ghost-btn,
  .template-card-actions .danger-btn {
    min-height: 38px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid rgba(229, 231, 235, 0.92);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-soft);
  }

  .data-table tbody tr:hover,
  .data-table tbody tr.is-selected {
    background: rgba(240, 253, 250, 0.96);
  }

  .data-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 9px 0;
    border-top: 1px dashed rgba(229, 231, 235, 0.9);
    font-size: 13px;
    white-space: normal;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
  }

  .data-table td:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .data-table td[colspan] {
    display: block;
    padding: 0;
    border-top: 0;
  }

  .data-table td[colspan]::before {
    content: none;
  }

  .select-column-head,
  .key-select-cell,
  .key-column-head,
  .key-primary-cell,
  .actions-column-head {
    width: auto;
    min-width: 0;
  }

  .data-table td.key-select-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
  }

  .data-table td.key-select-cell::before {
    content: attr(data-label);
  }

  .table-check {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(20, 184, 166, 0.08);
  }

  .table-check input {
    width: 18px;
    height: 18px;
  }

  .key-cell-top,
  .key-cell-actions,
  .data-table-actions {
    width: 100%;
  }

  .key-cell-top {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .key-cell-value {
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
    font-size: 12px;
  }

  .key-cell-actions,
  .data-table-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .table-inline-btn {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
  }

  .group-chip {
    max-width: 100%;
  }

  .table-footer {
    display: grid;
    gap: 10px;
    align-items: stretch;
  }

  .table-summary {
    text-align: center;
  }

  .pager {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
  }

  .pager .ghost-btn {
    width: 100%;
  }

  .modal {
    align-items: end;
    place-items: end stretch;
    padding: 0;
  }

  .modal-dialog,
  .modal-dialog-wide,
  .account-bulk-dialog,
  #create-key-modal .create-key-dialog,
  .key-detail-dialog {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    border-radius: 20px 20px 0 0;
    border-right: 0;
    border-left: 0;
    border-bottom: 0;
  }

  .modal-head,
  #create-key-modal .modal-head,
  .account-bulk-dialog .modal-head {
    position: sticky;
    top: 0;
    z-index: 8;
    align-items: center;
    padding: 14px 14px 12px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.92);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
  }

  .modal-head h3 {
    font-size: 17px;
  }

  .modal-close {
    min-height: 38px;
    padding: 0 12px;
  }

  .modal-body,
  #create-key-modal .modal-body {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .form-grid,
  .two-col-grid,
  .three-col-grid,
  .detail-summary-grid,
  .detail-status-grid,
  .detail-action-grid,
  .detail-control-grid,
  .key-detail-ip-grid {
    grid-template-columns: 1fr;
  }

  .modal-actions,
  #create-key-modal .modal-actions,
  .key-detail-dialog .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 7;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(229, 231, 235, 0.92);
  }

  .modal-actions .primary-btn,
  .modal-actions .secondary-btn,
  .modal-actions .ghost-btn,
  .modal-actions .danger-btn {
    width: 100%;
  }

  #create-key-modal .create-key-dialog {
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  #create-key-form {
    min-height: 0;
    overflow: auto;
  }

  #create-key-modal .create-key-scroll-area {
    gap: 12px;
  }

  #create-key-modal .preview-card {
    padding: 10px;
  }

  .key-detail-dialog {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .key-detail-dialog .modal-body {
    padding: 12px 14px 0;
  }

  .detail-sidebar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "key"
      "copy"
      "facts";
  }

  .detail-sidebar > .detail-fact-grid,
  .detail-sidebar > .detail-fact-grid > .detail-fact-grid-tight {
    grid-template-columns: 1fr;
  }

  .detail-key-value.code-block {
    font-size: 12px;
  }

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

  .detail-action-grid .danger-btn {
    grid-column: 1 / -1;
  }

  .account-bulk-form {
    gap: 12px;
  }

  .bulk-edit-grid,
  .bulk-group-check-list {
    grid-template-columns: 1fr;
  }

  .bulk-edit-card {
    padding: 10px;
  }

  .bulk-group-check-list {
    max-height: 240px;
    padding: 10px;
  }
}

@media (max-width: 380px) {
  .dashboard-stat-grid,
  .filter-actions,
  .key-cell-actions,
  .data-table-actions,
  .template-card-actions,
  .detail-action-grid,
  .modal-actions,
  #create-key-modal .modal-actions,
  .key-detail-dialog .modal-actions {
    grid-template-columns: 1fr;
  }

  .data-table td {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}
