/* ============================================
   社内システム共通マスター登録 - Styles
   Linear/Notion風 ミニマル業務系 ライトモード
   ============================================ */

:root {
  /* Surfaces */
  --bg: #fafaf9;
  --bg-subtle: #f5f5f4;
  --surface: #ffffff;
  --surface-hover: #f9f9f8;
  --surface-active: #f0efed;

  /* Borders */
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --border-focus: #a8a29e;

  /* Text */
  --text: #1c1917;
  --text-muted: #57534e;
  --text-subtle: #78716c;
  --text-faint: #a8a29e;
  --text-inverse: #fafaf9;

  /* Accent (overridable via tweaks) */
  --accent: #3b3bdc;
  --accent-hover: #2e2eb8;
  --accent-soft: #eeeefd;
  --accent-border: #d5d5fa;

  /* Status */
  --success: oklch(0.55 0.13 150);
  --success-soft: oklch(0.96 0.025 150);
  --warning: oklch(0.62 0.14 70);
  --warning-soft: oklch(0.97 0.03 80);
  --danger: oklch(0.55 0.18 27);
  --danger-soft: oklch(0.97 0.02 27);
  --info: oklch(0.55 0.13 245);
  --info-soft: oklch(0.97 0.02 245);

  /* Typography */
  --font-sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;

  /* Sizing */
  --row-h: 36px;
  --row-h-compact: 30px;
  --row-h-spacious: 44px;
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 56px;
  --topbar-h: 48px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04), 0 1px 1px rgba(28, 25, 23, 0.03);
  --shadow-md: 0 4px 12px rgba(28, 25, 23, 0.06), 0 1px 3px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 16px 40px rgba(28, 25, 23, 0.12), 0 4px 12px rgba(28, 25, 23, 0.05);
  --shadow-xl: 0 24px 64px rgba(28, 25, 23, 0.18), 0 8px 20px rgba(28, 25, 23, 0.08);

  /* Z */
  --z-modal: 1000;
  --z-tweaks: 1100;
}

[data-density="compact"] {
  --row-h: var(--row-h-compact);
}

[data-density="spacious"] {
  --row-h: var(--row-h-spacious);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt";
}

#root { height: 100vh; }

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

button { cursor: pointer; }

/* ============== Layout shell ============== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  background: var(--bg);
}
.app-shell[data-collapsed="true"] { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  height: var(--topbar-h);
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.01em;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1c1917 0%, #3b3bdc 110%);
  display: inline-grid; place-items: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.sidebar-brand .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-section {
  padding: 12px 8px 4px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.app-shell[data-collapsed="true"] .sidebar-section,
.app-shell[data-collapsed="true"] .brand-name,
.app-shell[data-collapsed="true"] .nav-item-label,
.app-shell[data-collapsed="true"] .nav-item-count,
.app-shell[data-collapsed="true"] .sidebar-user-info { display: none; }

.sidebar-nav { padding: 0 6px; display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  user-select: none;
}
.nav-item:hover { background: var(--surface-active); color: var(--text); }
.nav-item[data-active="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.nav-item-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-subtle); }
.nav-item[data-active="true"] .nav-item-icon { color: var(--accent); }
.nav-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  background: transparent;
  padding: 1px 4px;
  border-radius: 3px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.sidebar-user:hover { background: var(--surface-active); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10.5px; color: var(--text-subtle); }

/* ============== Main column ============== */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.breadcrumb .crumb-sep { color: var(--text-faint); }
.breadcrumb .crumb-current { color: var(--text); font-weight: 500; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
}
.role-pill:hover { border-color: var(--border-strong); }
.role-pill .role-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.role-pill[data-role="viewer"] .role-dot { background: var(--text-faint); }
.role-pill[data-role="editor"] .role-dot { background: var(--info); }
.role-pill[data-role="admin"] .role-dot { background: var(--accent); }

.content {
  flex: 1;
  overflow: auto;
  padding: 24px 28px;
}

/* ============== Buttons ============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 80ms, border-color 80ms;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn[data-variant="primary"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--text-inverse);
}
.btn[data-variant="primary"]:hover { background: #000; }
.btn[data-variant="accent"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn[data-variant="accent"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn[data-variant="ghost"] { border-color: transparent; background: transparent; }
.btn[data-variant="ghost"]:hover { background: var(--surface-active); }
.btn[data-variant="danger"] {
  background: white; color: var(--danger); border-color: var(--border);
}
.btn[data-variant="danger"]:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn[data-size="sm"] { height: 24px; padding: 0 8px; font-size: 11.5px; }
.btn[data-size="lg"] { height: 36px; padding: 0 14px; font-size: 13px; }
.btn[data-icon-only="true"] { width: 28px; padding: 0; }
.btn[data-icon-only="true"][data-size="sm"] { width: 24px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-active); color: var(--text); }

/* ============== Inputs ============== */
.input {
  display: inline-flex; align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text);
  width: 100%;
  outline: none;
  transition: border-color 80ms, box-shadow 80ms;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-faint); }
textarea.input {
  height: auto; padding: 6px 10px;
  resize: vertical; line-height: 1.55;
}
select.input { cursor: pointer; padding-right: 26px; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%2378716c' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.input-search {
  position: relative;
}
.input-search .input { padding-left: 28px; }
.input-search .search-icon {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 11.5px; font-weight: 500; color: var(--text-muted); }
.field-label .req { color: var(--danger); margin-left: 2px; }
.field-hint { font-size: 11px; color: var(--text-subtle); }
.field-error { font-size: 11px; color: var(--danger); }

/* ============== Tables ============== */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-scroll { overflow: auto; max-height: 100%; }

table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.data-table thead th {
  position: sticky; top: 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11.5px;
  padding: 0 10px;
  height: 32px;
  white-space: nowrap;
  user-select: none;
  z-index: 1;
}
.data-table thead th[data-sortable="true"] { cursor: pointer; }
.data-table thead th[data-sortable="true"]:hover { color: var(--text); background: var(--surface-active); }
.data-table thead th .sort-ind {
  display: inline-block;
  margin-left: 4px;
  color: var(--text-faint);
  font-size: 10px;
}
.data-table thead th[data-sorted] .sort-ind { color: var(--text); }

.data-table tbody tr {
  height: var(--row-h);
  transition: background 60ms;
}
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody tr[data-selected="true"] { background: var(--accent-soft); }
.data-table tbody td {
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-gridlines="true"] .data-table tbody td:not(:last-child) { border-right: 1px solid var(--border); }
[data-gridlines="true"] .data-table thead th:not(:last-child) { border-right: 1px solid var(--border); }

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .col-check { width: 32px; padding-left: 10px; padding-right: 0; }
.data-table .col-actions { width: 60px; text-align: right; }
.data-table .row-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity 80ms; }
.data-table tbody tr:hover .row-actions,
.data-table tbody tr[data-selected="true"] .row-actions { opacity: 1; }

.mono { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: -0.01em; }

/* ============== Toolbar (above table) ============== */
.list-header {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 16px;
}
.list-title-row { display: flex; align-items: center; gap: 12px; }
.list-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.list-subtitle { color: var(--text-subtle); font-size: 12.5px; }
.list-toolbar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.list-toolbar .grow { flex: 1; min-width: 200px; }
.toolbar-divider { width: 1px; height: 18px; background: var(--border); }

.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 11.5px;
  color: var(--text-muted);
  background: transparent;
}
.filter-chip[data-active="true"] {
  border-style: solid;
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}
.filter-chip .chip-value { color: var(--text); font-weight: 500; }
.filter-chip .chip-clear {
  display: inline-grid; place-items: center;
  width: 14px; height: 14px;
  border-radius: 3px;
  margin-left: 2px;
}
.filter-chip .chip-clear:hover { background: var(--surface-active); }

/* ============== Badge / Tag ============== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge[data-tone="success"] { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge[data-tone="warning"] { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge[data-tone="danger"] { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge[data-tone="info"] { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge[data-tone="accent"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge .status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tag {
  display: inline-flex; align-items: center;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}
.tag-group { display: inline-flex; flex-wrap: wrap; gap: 3px; max-width: 100%; }

/* ============== Avatar ============== */
.avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: inline-grid; place-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.avatar[data-size="sm"] { width: 20px; height: 20px; font-size: 9.5px; }
.avatar[data-size="lg"] { width: 36px; height: 36px; font-size: 13px; }
.avatar[data-size="xl"] { width: 72px; height: 72px; font-size: 24px; }
.avatar-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.avatar-name-text { display: flex; flex-direction: column; min-width: 0; }
.avatar-name-text .name-main { font-size: 12.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-name-text .name-sub { font-size: 10.5px; color: var(--text-faint); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============== Checkbox ============== */
.cb {
  appearance: none;
  width: 14px; height: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface);
  position: relative;
  cursor: pointer;
  vertical-align: middle;
}
.cb:checked { background: var(--accent); border-color: var(--accent); }
.cb:checked::after {
  content: ''; position: absolute;
  left: 3px; top: 0px; width: 5px; height: 9px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.cb:indeterminate { background: var(--accent); border-color: var(--accent); }
.cb:indeterminate::after {
  content: ''; position: absolute;
  left: 2px; top: 5px; width: 8px; height: 2px;
  background: white;
}

/* ============== Modal ============== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(28, 25, 23, 0.32);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: var(--z-modal);
  padding: 24px;
  animation: fadeIn 120ms ease-out;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: popIn 140ms ease-out;
}
.modal[data-size="lg"] { max-width: 720px; }
.modal[data-size="xl"] { max-width: 920px; }
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.modal-title { font-size: 14px; font-weight: 600; margin: 0; }
.modal-subtitle { font-size: 12px; color: var(--text-subtle); }
.modal-body { padding: 18px; overflow: auto; flex: 1; }
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  justify-content: flex-end;
  background: var(--bg-subtle);
}
.modal-footer .grow { margin-right: auto; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.98) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============== Forms ============== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.form-grid .col-2 { grid-column: span 2; }
.form-section-title {
  grid-column: span 2;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.form-section-title:first-child { margin-top: 0; }

/* ============== Empty / Loading ============== */
.empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-subtle);
}
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.empty-state p { font-size: 12.5px; margin: 0; }

/* ============== Pagination ============== */
.pagination {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.pagination .pages { display: inline-flex; gap: 2px; }
.page-btn {
  min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 3px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 11.5px;
  color: var(--text-muted);
}
.page-btn:hover { background: var(--surface-active); color: var(--text); }
.page-btn[data-active="true"] { background: var(--text); color: white; }

/* ============== Toast ============== */
.toast-stack {
  position: fixed; bottom: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 1200;
}
.toast {
  background: var(--text);
  color: var(--text-inverse);
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  animation: slideUp 160ms ease-out;
  min-width: 240px;
  max-width: 360px;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============== Dashboard cards ============== */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  max-width: 880px;
}
.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
  transition: border-color 100ms, box-shadow 100ms, transform 100ms;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.menu-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.menu-card:active { transform: scale(0.998); }
.menu-card-head { display: flex; align-items: flex-start; gap: 12px; }
.menu-card-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.menu-card-title { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.005em; }
.menu-card-desc { font-size: 12px; color: var(--text-subtle); margin: 2px 0 0; line-height: 1.5; }
.menu-card-stats { display: flex; gap: 20px; }
.stat .stat-v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.stat .stat-l { font-size: 11px; color: var(--text-subtle); }
.menu-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-subtle);
}

.section-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.section-row:last-child { border-bottom: none; }
.section-row-head { font-size: 13px; font-weight: 600; }
.section-row-desc { font-size: 12px; color: var(--text-subtle); margin-top: 2px; }

/* ============== Login ============== */
.login-page {
  height: 100vh;
  background: var(--bg);
  overflow: auto;
  position: relative;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
  pointer-events: none;
}
.login-single {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 24px;
  gap: 28px;
}
.login-brand-top {
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-brand-top .brand-mark {
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(28, 25, 23, 0.14), 0 2px 6px rgba(28, 25, 23, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.login-card {
  width: 100%;
  max-width: 400px;
  display: flex; flex-direction: column; gap: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 10px 40px rgba(28, 25, 23, 0.06), 0 2px 8px rgba(28, 25, 23, 0.03);
}
.login-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  margin: 0;
}
.login-subtitle {
  color: var(--text-subtle);
  font-size: 13px;
  margin: 8px 0 0;
  line-height: 1.6;
}

.ms-button {
  display: flex; align-items: center; gap: 10px;
  height: 44px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  justify-content: center;
  transition: background 80ms, border-color 80ms, box-shadow 80ms;
}
.ms-button:hover { background: var(--surface-hover); border-color: var(--text-muted); box-shadow: var(--shadow-sm); }
.ms-button[data-loading="true"] { color: var(--text-subtle); cursor: wait; }

.ms-logo {
  width: 18px; height: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
}
.ms-logo span { display: block; }
.ms-logo span:nth-child(1) { background: #f25022; }
.ms-logo span:nth-child(2) { background: #7fba00; }
.ms-logo span:nth-child(3) { background: #00a4ef; }
.ms-logo span:nth-child(4) { background: #ffb900; }

.login-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-faint);
  font-size: 11px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.login-meta {
  display: flex; gap: 16px;
  color: var(--text-subtle);
  font-size: 11.5px;
}
.login-meta a { color: var(--text-subtle); text-decoration: none; }
.login-meta a:hover { color: var(--text); }

/* ============== Dropdown ============== */
.dropdown {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 160px;
  z-index: 50;
  font-size: 12.5px;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border-radius: 3px;
  border: none;
  background: transparent;
  text-align: left;
  color: var(--text);
}
.dropdown-item:hover { background: var(--surface-active); }
.dropdown-item[data-danger="true"] { color: var(--danger); }
.dropdown-item[data-danger="true"]:hover { background: var(--danger-soft); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-label {
  padding: 6px 8px 4px;
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============== Drawer / side panel ============== */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(28, 25, 23, 0.2);
  z-index: var(--z-modal);
  animation: fadeIn 120ms ease-out;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  display: flex; flex-direction: column;
  animation: slideLeft 180ms ease-out;
}
@keyframes slideLeft { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============== Misc ============== */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.row-flex { display: flex; align-items: center; gap: 8px; }
.row-flex.gap-12 { gap: 12px; }
.row-flex.gap-16 { gap: 16px; }
.col-flex { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--text-subtle); }
.faint { color: var(--text-faint); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }

.shortcut {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.kbd-hint {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-faint);
}

/* Tweaks panel positioning override */
.tweaks-panel { z-index: var(--z-tweaks) !important; }

/* Skeleton loader */
.skeleton { display: inline-block; height: 12px; border-radius: 3px;
  background: linear-gradient(90deg, var(--bg-subtle), var(--surface-active), var(--bg-subtle));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Login splash spinner */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Photo placeholder striped */
.photo-stripes {
  background:
    repeating-linear-gradient(135deg,
      var(--bg-subtle) 0,
      var(--bg-subtle) 4px,
      var(--surface) 4px,
      var(--surface) 8px);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 9px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
}
