:root,
[data-theme="dark"] {
  --bg-canvas: #0B0F19;
  --bg-surface: #111827;
  --bg-elevated: #1E293B;
  --border-subtle: #1F2937;
  --border-focus: #3B82F6;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --color-primary: #3B82F6;
  --color-primary-hover: #2563EB;
  --color-primary-bg: rgba(59, 130, 246, 0.15);
  --status-up: #10B981;
  --status-up-bg: rgba(16, 185, 129, 0.15);
  --status-warn: #F59E0B;
  --status-warn-bg: rgba(245, 158, 11, 0.15);
  --status-down: #EF4444;
  --status-down-bg: rgba(239, 68, 68, 0.15);
  --status-idle: #6366F1;
  --status-idle-bg: rgba(99, 102, 241, 0.15);
  --status-unknown: #64748B;
  --status-unknown-bg: rgba(100, 116, 139, 0.15);

  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-pill: 9999px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
  --grid-line: rgba(148, 163, 184, 0.04);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-canvas: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F1F5F9;
  --border-subtle: #E2E8F0;
  --border-focus: #2563EB;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  --color-primary: #2563EB;
  --color-primary-hover: #1D4ED8;
  --color-primary-bg: rgba(37, 99, 235, 0.12);
  --status-up: #10B981;
  --status-up-bg: rgba(16, 185, 129, 0.15);
  --status-warn: #F59E0B;
  --status-warn-bg: rgba(245, 158, 11, 0.15);
  --status-down: #EF4444;
  --status-down-bg: rgba(239, 68, 68, 0.15);
  --status-idle: #6366F1;
  --status-idle-bg: rgba(99, 102, 241, 0.15);
  --status-unknown: #64748B;
  --status-unknown-bg: rgba(100, 116, 139, 0.15);

  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-pill: 9999px;
  --shadow-card: 0 8px 24px -8px rgba(15, 23, 42, 0.08);
  --grid-line: rgba(15, 23, 42, 0.035);
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-canvas);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.font-mono,
code,
pre,
.tabular-nums {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

[hidden] {
  display: none !important;
}

/* Touch target baseline (>= 44x44px per docs/frontend-design.md 1.4) */
button,
.btn,
.tab-btn,
.filter-pill,
input,
select {
  font-family: inherit;
  font-size: 14px;
}

.touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* Top App Shell Header */
.pub-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
}

.pub-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
}

.brand-titles {
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
}

.surface-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border: 1px solid rgba(59, 130, 246, 0.3);
  white-space: nowrap;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Desktop Navigation Tabs */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  min-height: 38px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--color-primary);
}

.icon-btn-danger:hover {
  border-color: var(--status-down);
  color: var(--status-down);
}

/* Main Container */
.pub-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

/* Status & Feedback Banner (#status) */
.status-banner-wrap {
  margin-bottom: 16px;
}

.status-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-card);
}

.status-banner.tone-error {
  border-color: rgba(239, 68, 68, 0.45);
  background: var(--status-down-bg);
  color: var(--status-down);
}

.status-banner.tone-warn {
  border-color: rgba(245, 158, 11, 0.45);
  background: var(--status-warn-bg);
  color: var(--status-warn);
}

.status-banner.tone-ok {
  border-color: rgba(16, 185, 129, 0.45);
  background: var(--status-up-bg);
  color: var(--status-up);
}

.status-banner.tone-info {
  border-color: rgba(59, 130, 246, 0.45);
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-up {
  background: var(--status-up-bg);
  color: var(--status-up);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-up .badge-dot {
  background: var(--status-up);
  box-shadow: 0 0 6px var(--status-up);
}

.badge-idle {
  background: var(--status-idle-bg);
  color: var(--status-idle);
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.badge-idle .badge-dot {
  background: var(--status-idle);
}

.badge-primary {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.badge-primary .badge-dot {
  background: var(--color-primary);
}

.badge-warn {
  background: var(--status-warn-bg);
  color: var(--status-warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-warn .badge-dot {
  background: var(--status-warn);
}

.badge-down {
  background: var(--status-down-bg);
  color: var(--status-down);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-down .badge-dot {
  background: var(--status-down);
}

.badge-unknown {
  background: var(--status-unknown-bg);
  color: var(--text-secondary);
  border: 1px solid rgba(100, 116, 139, 0.3);
}
.badge-unknown .badge-dot {
  background: var(--status-unknown);
}

/* Login Page (#login) */
.login-shell {
  min-height: calc(100vh - 150px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.login-accent-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--status-up) 100%);
}

.login-body {
  padding: 24px 20px;
}

.login-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.login-policy-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  font-size: 12px;
}

.policy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.policy-label {
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.text-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.input-With-action {
  padding-right: 68px;
}

.input-action-btn {
  position: absolute;
  right: 6px;
  min-height: 36px;
  min-width: 54px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--color-primary);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-primary);
}

.btn-success {
  min-height: 48px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--status-up);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.kpi-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Section Card & Toolbar */
.surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.toolbar-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-pill {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFFFFF;
}

.search-refresh-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  flex: 1;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Mobile Attendance Cards (< 768px) */
.att-mobile-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.att-person-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.att-person-card.st-complete {
  border-left-color: var(--status-up);
}
.att-person-card.st-in {
  border-left-color: var(--color-primary);
}
.att-person-card.st-miss {
  border-left-color: var(--status-warn);
}

.att-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.att-person-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.att-person-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.att-time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.att-time-cell {
  display: flex;
  flex-direction: column;
}

.att-time-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.att-time-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.att-time-val.muted {
  color: var(--text-muted);
  font-weight: 500;
}

.att-card-foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.att-project-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Desktop Attendance Table (>= 768px) */
.att-desktop-table-wrap {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ops-table th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.ops-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.ops-table tbody tr:hover {
  background: var(--bg-elevated);
}

/* SMS Step-by-Step Screen (/sms) */
.sms-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.step-indicator {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.step-pill {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-pill.active {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.step-pill.done {
  border-color: rgba(16, 185, 129, 0.4);
  background: var(--status-up-bg);
  color: var(--status-up);
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: var(--bg-surface);
  flex-shrink: 0;
}

/* Giant 6-Digit TOTP Input Component */
.totp-stage {
  padding: 20px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  text-align: center;
  margin-bottom: 16px;
}

.totp-stage-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.totp-stage-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.totp-box-wrapper {
  position: relative;
  max-width: 380px;
  margin: 0 auto 14px;
}

.totp-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.totp-slot {
  height: 56px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.totp-slot.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
  transform: translateY(-1px);
}

.totp-slot.filled {
  border-color: rgba(59, 130, 246, 0.55);
}

.totp-native-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 24px;
  letter-spacing: 24px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
}

.totp-helper-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

/* Code Vault Result Display */
.code-vault {
  padding: 24px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid rgba(16, 185, 129, 0.4);
  text-align: center;
  margin-bottom: 16px;
}

.code-display {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--text-primary);
  margin: 12px 0;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  display: inline-block;
  min-width: 220px;
}

.ttl-progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 12px 0 6px;
}

.ttl-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--status-up) 0%, var(--color-primary) 100%);
  transition: width 1s linear;
}

.code-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

/* Grants History List */
.grant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

/* Status / Lockout / Error Dedicated View Card */
.status-page-card {
  max-width: 560px;
  margin: 16px auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-card);
}

.status-icon-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
}

.status-rule-list {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

.status-rule-list div + div {
  margin-top: 6px;
}

/* Mobile Bottom Tab Bar (< 768px) */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

.mobile-tab {
  min-height: 58px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.mobile-tab.active {
  color: var(--color-primary);
}

.mobile-tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22%;
  right: 22%;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--color-primary);
}

/* Dynamic Security Watermark */
.sec-watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  overflow: hidden;
  opacity: 0.035;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 60px;
  padding: 40px;
  align-content: space-around;
  user-select: none;
}

.sec-watermark span {
  transform: rotate(-18deg);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-primary);
}

/* Responsive Breakpoints (>= 768px md, >= 1024px lg) */
@media (min-width: 640px) {
  .code-actions-grid {
    grid-template-columns: 1fr 1fr;
  }
  .toolbar-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 768px) {
  .pub-header-inner {
    padding: 12px 24px;
  }
  .pub-container {
    padding: 24px 24px 48px;
  }
  .desktop-nav {
    display: inline-flex;
  }
  .user-pill {
    display: inline-flex;
  }
  .mobile-bottom-nav {
    display: none;
  }
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
  .att-mobile-list {
    display: none;
  }
  .att-desktop-table-wrap {
    display: block;
  }
  .totp-slot {
    height: 64px;
    font-size: 30px;
  }
}

@media (min-width: 1024px) {
  .pub-header-inner {
    padding: 12px 32px;
  }
  .pub-container {
    padding: 28px 32px 56px;
  }
  .sms-layout {
    grid-template-columns: 7fr 5fr;
    align-items: start;
  }
}
