@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --primary-bg: #eef2ff;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 15px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.06), 0 20px 40px rgba(0, 0, 0, 0.04);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --gray-50: #1a1a2e;
  --gray-100: #222240;
  --gray-200: #2e2e4a;
  --gray-300: #3d3d5c;
  --gray-400: #6b7280;
  --gray-500: #9ca3af;
  --gray-600: #c0c0d0;
  --gray-700: #d0d0e0;
  --gray-800: #e8e8f0;
  --gray-900: #f0f0ff;
  --primary-bg: rgba(79, 70, 229, 0.18);
  --success-bg: rgba(5, 150, 105, 0.18);
  --danger-bg: rgba(220, 38, 38, 0.18);
  --info-bg: rgba(37, 99, 235, 0.18);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.35), 0 10px 15px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.35), 0 20px 40px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%);
}

[data-theme="dark"] .container {
  background: rgba(26, 26, 46, 0.92);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .app-header {
  background: rgba(15, 15, 35, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .submit-footer {
  background: rgba(15, 15, 35, 0.92);
  border-top-color: var(--gray-200);
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control,
[data-theme="dark"] .feed-filter-input {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-theme="dark"] .feed-panel {
  background: var(--gray-50);
}

[data-theme="dark"] .feed-filter {
  background: var(--gray-100);
}

[data-theme="dark"] .feed-entry {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

[data-theme="dark"] .card {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

[data-theme="dark"] .table-wrap th {
  background: var(--gray-100);
  color: var(--gray-500);
}

[data-theme="dark"] .table-wrap td {
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .table-wrap tr:hover td {
  background: var(--gray-100);
}

[data-theme="dark"] code {
  background: var(--gray-200);
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] .modal-box {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

[data-theme="dark"] .profile-detail {
  border-top-color: var(--gray-200);
}

[data-theme="dark"] .profile-detail-value {
  color: var(--gray-600);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  scroll-behavior: smooth;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #fdfbf7 0%, #f0f4ff 50%, #fdf2f8 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--gray-800);
  -webkit-font-smoothing: antialiased;
}

#devoForm {
  padding-bottom: 1rem;
}

/* ── Submit sticky footer ── */
.submit-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--gray-200);
  padding: 0.75rem 1rem;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}

.submit-footer-inner {
  max-width: 580px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.submit-footer-inner button[type="submit"] {
  min-width: 220px;
}

body.has-header {
  padding-top: calc(60px + 2rem);
  padding-bottom: 72px;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light));
  z-index: 100;
}

.container {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  position: relative;
  animation: fadeUp 0.4s ease-out;
}

.container.wide {
  max-width: 920px;
}

.container.tracker {
  max-width: 580px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 1.5rem;
  text-align: center;
  letter-spacing: -0.02em;
}

.logo-icon {
  display: block;
  font-size: 2.4rem;
  margin-bottom: 0.4rem;
  line-height: 1;
}

h1 .logo-icon {
  display: inline-block;
  font-size: 1.8rem;
  margin-bottom: 0;
  margin-right: 0.3rem;
  vertical-align: middle;
}

h1::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  margin: 0.6rem auto 0;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
}

.text-center { text-align: center; }
.mb-1 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.75rem; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ── Header ── */
.app-header {
  position: fixed;
  top: 4px;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.header-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none !important;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--gray-900);
}

.header-logo .logo-icon {
  font-size: 1.4rem;
  line-height: 1;
  margin: 0;
  display: inline-block;
}

.header-logo:hover {
  color: var(--primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
}

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.search-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  line-height: 1;
  pointer-events: none;
  opacity: 0.5;
  z-index: 1;
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 56px 0 12px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: var(--gray-50);
  font-size: 0.82rem;
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
  background: #fff;
}

.search-input::placeholder {
  color: var(--gray-400);
}

.search-clear {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--gray-300);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.search-clear:hover {
  background: var(--gray-400);
}

.search-input:not(:placeholder-shown) ~ .search-clear {
  display: flex;
}

[data-theme="dark"] .search-input {
  background: var(--gray-800);
  border-color: var(--gray-700);
  color: var(--gray-200);
}

[data-theme="dark"] .search-input:focus {
  background: var(--gray-800);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

[data-theme="dark"] .search-clear {
  background: var(--gray-600);
}

[data-theme="dark"] .search-clear:hover {
  background: var(--gray-500);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.header-nav a {
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-500);
  text-decoration: none;
  transition: all var(--transition);
}

.header-nav a:hover {
  background: var(--primary-bg);
  color: var(--primary);
  text-decoration: none;
}

.header-nav a.active {
  background: var(--primary-bg);
  color: var(--primary);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.65rem 0.3rem 0.5rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  transition: all var(--transition);
}

.header-user:hover {
  border-color: var(--gray-300);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-cell-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.9rem;
  line-height: 1.3;
}

.user-cell-id {
  font-size: 0.72rem;
  color: var(--gray-400);
  font-family: monospace;
  line-height: 1.2;
}

.user-row {
  cursor: pointer;
  transition: background var(--transition);
}

.user-row:hover {
  background: var(--primary-bg);
}

.user-row td:first-child {
  border-radius: var(--radius-xs) 0 0 var(--radius-xs);
}

.user-row td:last-child {
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-meta .user-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
}

.user-meta .user-role {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: capitalize;
}

.header-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-400);
  font-size: 1rem;
  text-decoration: none !important;
  transition: all var(--transition);
  margin-left: 0.15rem;
}

.header-logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.header-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-400);
  font-size: 0.9rem;
  text-decoration: none !important;
  transition: all var(--transition);
  margin-left: 0.15rem;
}

.header-link:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-400);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  line-height: 1;
}

.theme-toggle:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}

.btn-link:hover {
  background: var(--primary-bg);
  text-decoration: none;
}

/* ── Flash messages ── */
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.flash.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.flash.info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid #bfdbfe;
}

/* ── User info card ── */
.user-card {
  background: linear-gradient(135deg, var(--gray-50), #fff);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.user-field {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}

.user-field + .user-field {
  border-top: 1px solid var(--gray-100);
}

.user-field-label {
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-field-value {
  color: var(--gray-900);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* ── Form ── */
.form-group {
  margin-bottom: 1.25rem;
}

.phone-input-group {
  display: flex;
  gap: 0.4rem;
}

.phone-input-group input {
  flex: 1;
}

.phone-input-group button {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  cursor: pointer;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: var(--gray-100);
  line-height: 1;
}

.phone-input-group button:hover {
  background: var(--gray-200);
}

label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  transition: all var(--transition);
  color: var(--gray-800);
}

.form-control {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  transition: all var(--transition);
  color: var(--gray-800);
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.hint {
  display: block;
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* ── Toggle switch ── */
.toggle-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.4rem 0;
  cursor: pointer;
}

.toggle-wrap input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--gray-300);
  border-radius: 12px;
  transition: all var(--transition);
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-wrap input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-wrap input:checked + .toggle-slider::after {
  left: 22px;
}

.toggle-label {
  margin-left: 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-600);
}

::placeholder {
  color: var(--gray-400);
  opacity: 1;
}

/* ── Offline banner ── */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #fef3cd;
  color: #856404;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-bottom: 1px solid #ffeeba;
  animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

body.is-offline.has-header {
  padding-top: calc(56px + 2.2rem);
}
@media (max-width: 640px) {
  body.is-offline.has-header {
    padding-top: calc(52px + 2.2rem);
  }
}
@media (max-width: 480px) {
  body.is-offline.has-header {
    padding-top: calc(48px + 2.2rem);
  }
}

/* ── Feed panel ── */
.feed-toggle {
  position: fixed;
  top: 80px;
  right: 0;
  z-index: 150;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px 0 0 8px;
  padding: 10px 10px;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: right var(--transition);
  line-height: 1;
}
.feed-toggle:hover {
  background: var(--primary-dark);
}

.feed-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  z-index: 300;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.feed-panel.open {
  right: 0;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.feed-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
}
.feed-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
}
.feed-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.feed-filter {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
}
.feed-filter-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.feed-filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.feed-filter-input {
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--gray-800);
  outline: none;
  transition: border-color var(--transition);
}
.feed-filter-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}

.feed-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}
.feed-body::-webkit-scrollbar {
  width: 5px;
}
.feed-body::-webkit-scrollbar-track {
  background: transparent;
}
.feed-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.feed-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--gray-400);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
}

.feed-entry {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  margin-bottom: 0.5rem;
  border: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.feed-entry:hover {
  background: var(--primary-bg);
  border-color: var(--primary-light);
}
.feed-entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}
.feed-entry-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 8px;
  border-radius: 4px;
}
.feed-entry-phone {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-family: monospace;
}
.feed-entry-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0.15rem 0;
}
.feed-entry-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--gray-500);
}
.feed-entry-pending {
  border-left: 3px solid #f59e0b;
}
.feed-entry-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}
.feed-entry-status-pending {
  color: #b45309;
  background: #fef3c7;
}
.feed-entry-status-delivered {
  color: #065f46;
  background: #d1fae5;
}
[data-theme="dark"] .feed-entry-status-pending {
  color: #fbbf24;
  background: #451a03;
}
[data-theme="dark"] .feed-entry-status-delivered {
  color: #34d399;
  background: #064e3b;
}

.feed-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.feed-count {
  font-size: 0.8rem;
  color: var(--gray-500);
}
.feed-refresh {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
}
.feed-refresh:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

/* ── User Profile Modal ── */
.profile-card {
  text-align: center;
}
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}
.profile-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
}
.profile-role {
  font-size: 0.8rem;
  color: var(--gray-500);
  text-transform: capitalize;
  margin-bottom: 1rem;
}
.profile-detail {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.85rem;
}
.profile-detail:last-child {
  border-bottom: none;
}
.profile-detail-label {
  color: var(--gray-500);
}
.profile-detail-value {
  color: var(--gray-800);
  font-weight: 500;
  text-align: right;
}

.profile-info-line {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--gray-700);
  line-height: 1.6;
}

.edit-profile-link {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.edit-profile-link:hover {
  color: var(--primary-dark);
}

.profile-edit-form .form-group {
  margin-bottom: 0.85rem;
}

.profile-edit-form .form-group:last-of-type {
  margin-bottom: 0;
}

/* ── Member suggestion modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.open {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--gray-100);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--gray-500);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.modal-body {
  overflow-y: auto;
  padding: 0.5rem 0;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.member-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--gray-50);
}

.member-option:last-child {
  border-bottom: none;
}

.member-option:hover {
  background: var(--primary-bg);
}

.member-option:active {
  background: #dde4ff;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-info .member-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-900);
}

.member-info .member-detail {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 0.1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.member-info .member-detail span {
  white-space: nowrap;
}

.member-check {
  font-size: 1rem;
  color: var(--gray-300);
  flex-shrink: 0;
}

.modal-empty {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.85rem;
}

.selected-dates {
  margin-bottom: 2.5rem;
}

.date-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.date-list li {
  background: linear-gradient(135deg, var(--primary-bg), #e0e7ff);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
}

/* ── Buttons ── */
button[type="submit"] {
  padding: 0.65rem 1.4rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.01em;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

button[type="submit"]:active {
  transform: translateY(0);
}

button[type="submit"]:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  padding: 0.7rem 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
  padding: 0.65rem 1.3rem;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: var(--gray-200);
  border-color: var(--gray-300);
}

.btn-danger {
  padding: 0.35rem 0.7rem;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger.small,
.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.74rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-group {
  display: flex;
  gap: 0.35rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
}

/* ── Submit result ── */
.result {
  margin: 1rem 0 2.5rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-align: center;
  display: none;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

.result.success {
  display: block;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.result.error {
  display: block;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

/* ── Flatpickr ── */
.flatpickr-calendar {
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--gray-200) !important;
  margin: 0 auto 1rem !important;
  font-family: inherit !important;
}

.flatpickr-months {
  background: var(--gray-50) !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

.flatpickr-current-month {
  font-weight: 700 !important;
  font-size: 0.95rem !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.inRange {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}

.flatpickr-day.today {
  border-color: var(--primary) !important;
}

.flatpickr-day:hover {
  background: var(--primary-bg) !important;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.7rem;
  border-bottom: 1px solid var(--gray-100);
}

th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}

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

tbody tr:hover {
  background: var(--gray-50);
}

.badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  display: inline-block;
}

.badge.admin {
  background: var(--primary-bg);
  color: var(--primary);
}

.badge.user {
  background: #e0f2fe;
  color: #0369a1;
}

.badge.developer {
  background: #fef3c7;
  color: #92400e;
}

.badge.supervisor {
  background: #ede9fe;
  color: #5b21b6;
}

[data-theme="dark"] .badge.developer {
  background: #451a03;
  color: #fbbf24;
}

[data-theme="dark"] .badge.supervisor {
  background: #2e1065;
  color: #c4b5fd;
}

.confirm-box {
  max-width: 380px;
}

.confirm-header {
  border-bottom: none;
  justify-content: center;
}

.confirm-header h3 {
  color: var(--danger);
  font-size: 1.05rem;
}

.confirm-avatar {
  margin: 0.5rem 0 0.75rem;
  display: flex;
  justify-content: center;
}

.confirm-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-800);
}

.confirm-id {
  font-size: 0.8rem;
  color: var(--gray-400);
  font-family: monospace;
  margin-top: 0.15rem;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.confirm-actions .btn-secondary,
.confirm-actions .btn-danger {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* ── Card ── */
::placeholder {
  color: var(--gray-400);
  opacity: 1;
}

.card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

/* ── Form row ── */
.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-row .form-group {
  flex: 1;
}

/* ── Settings page ── */
textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-family: "SF Mono", Monaco, "Cascadia Code", Menlo, monospace;
  resize: vertical;
  transition: all var(--transition);
  background: #fff;
  color: var(--gray-800);
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

code {
  background: var(--gray-100);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: "SF Mono", Monaco, "Cascadia Code", Menlo, monospace;
}

/* ── Status grid ── */
.status-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.status-grid > div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  min-width: 130px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-value {
  font-size: 0.84rem;
  color: var(--gray-800);
  font-family: "SF Mono", Monaco, "Cascadia Code", Menlo, monospace;
  word-break: break-all;
}

/* ── Credentials display ── */
.creds-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.creds-header label {
  margin-bottom: 0;
}

.creds-pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: "SF Mono", Monaco, "Cascadia Code", Menlo, monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow-y: auto;
  line-height: 1.5;
}

.creds-pre::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.creds-pre::-webkit-scrollbar-track {
  background: transparent;
}

.creds-pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.creds-pre.is-masked {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  letter-spacing: 0.3em;
  color: #6b7080;
  user-select: none;
}

.field-with-mask {
  position: relative;
}

.field-mask-text {
  display: inline-flex;
  align-items: center;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: "SF Mono", Monaco, "Cascadia Code", Menlo, monospace;
  background: var(--gray-50);
  color: var(--gray-400);
  letter-spacing: 0.15em;
}

/* ── Settings tabs ── */
[id^="settings-"] {
  scroll-margin-top: 140px;
}
.settings-layout {
  max-width: 1100px;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding: 0.5rem 0 0.75rem;
  margin-bottom: 1.25rem;
  position: sticky;
  top: 56px;
  z-index: 10;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-tabs.is-sticky {
  border-bottom-color: var(--gray-200);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.settings-tabs a {
  display: block;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  transition: all var(--transition);
  line-height: 1.3;
  white-space: nowrap;
}

.settings-tabs a:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.settings-tabs a.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.settings-main {
  min-width: 0;
}

.table-nav {
  font-size: 0.82rem;
}

.table-nav summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--gray-500);
  padding: 0.25rem 0;
  user-select: none;
}

.table-nav-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.table-nav-list a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  transition: all var(--transition);
  line-height: 1.3;
}

.table-nav-list a:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.table-nav-list a.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.back-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.back-link:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .settings-tabs {
    gap: 0.1rem;
    padding: 0.4rem 0 0.6rem;
  }
  .settings-tabs a {
    font-size: 0.74rem;
    padding: 0.3rem 0.5rem;
  }
}

.section-divider {
  border: none;
  border-top: 2px solid var(--gray-200);
  margin: 2rem 0 1.5rem;
}

/* ── Workflow builder ── */
.wf-chip {
  display: inline-block;
  font-size: 0.74rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--primary-bg);
  color: var(--primary);
  margin: 0.12rem;
  white-space: nowrap;
  font-weight: 500;
}

.wf-chip.any {
  background: var(--gray-100);
  color: var(--gray-500);
  font-style: italic;
}

.wf-chip.action {
  background: var(--success-bg);
  color: var(--success);
}

tr.wf-disabled {
  opacity: 0.45;
}

.btn-toggle {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all var(--transition);
}

.btn-toggle.on {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.btn-toggle.off {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-toggle:hover {
  transform: scale(1.05);
}

.condition-row,
.action-row {
  align-items: center;
}

/* ── Custom scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .header-nav a {
    padding: 0.25rem 0.45rem;
    font-size: 0.76rem;
  }

  .user-meta .user-name {
    font-size: 0.74rem;
  }

  .user-meta .user-role {
    font-size: 0.62rem;
  }

  .header-user {
    padding: 0.25rem 0.45rem 0.25rem 0.35rem;
    gap: 0.4rem;
  }

  .feed-panel {
    width: 100%;
    max-width: 100%;
    right: -100%;
  }
}

@media (max-width: 640px) {
  body {
    padding: 1rem 0.75rem;
  }

  body.has-header {
    padding-top: calc(56px + 1rem);
    padding-bottom: 64px;
  }

  .header-inner {
    padding: 0 0.85rem;
    height: 52px;
  }

  .header-logo span:last-child {
    display: none;
  }

  .header-nav {
    gap: 0.1rem;
  }

  .header-nav a {
    padding: 0.2rem 0.35rem;
    font-size: 0.72rem;
  }

  .user-meta {
    display: none;
  }

  .header-user {
    padding: 0.2rem;
    gap: 0;
  }

  .header-logout {
    width: 22px;
    height: 22px;
    font-size: 0.85rem;
  }

  .header-link {
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
  }

  .theme-toggle {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .container {
    padding: 1.25rem;
    border-radius: 16px;
  }

  .container.wide {
    max-width: 100%;
  }

  .container.tracker {
    max-width: 100%;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-row .form-group {
    flex: none;
  }

  h1 {
    font-size: 1.3rem;
  }

  .user-field {
    flex-direction: column;
    gap: 0.15rem;
  }

  .user-field-value {
    text-align: left;
    max-width: 100%;
  }

  th, td {
    padding: 0.5rem 0.4rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  body.has-header {
    padding-top: calc(52px + 0.85rem);
    padding-bottom: 60px;
  }

  .header-inner {
    padding: 0 0.6rem;
    height: 48px;
  }

  .header-nav a {
    padding: 0.15rem 0.25rem;
    font-size: 0.68rem;
  }

  .user-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
  }

  .header-logout {
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
  }

  .theme-toggle {
    width: 24px;
    height: 24px;
    font-size: 0.9rem;
  }

  .header-link {
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
  }

  .container {
    padding: 1rem;
  }

  .btn-link {
    font-size: 0.75rem;
    padding: 0.2rem 0.35rem;
  }

  .submit-footer {
    padding: 0.6rem 0.85rem;
  }

  .submit-footer-inner button[type="submit"] {
    min-width: 0;
    width: 100%;
  }
}

/* ── Phone group (country code + number) ── */
.phone-group {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.phone-group .phone-code {
  flex: 0 0 auto;
  width: 110px;
  min-width: 110px;
  padding: 0.7rem 0.5rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  padding-right: 1.5rem;
}

.phone-group .phone-code:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.phone-group input[type="tel"] {
  flex: 1;
  min-width: 0;
}

/* ── Enumlist (multiselect with search + checkboxes) ── */
.enumlist-wrap {
  position: relative;
}

.enumlist-trigger {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 42px;
  padding: 0.4rem 0.5rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  transition: all var(--transition);
}

.enumlist-trigger:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.enumlist-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.enumlist-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--primary-bg);
  color: var(--primary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.enumlist-tag-x {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
}

.enumlist-tag-x:hover {
  opacity: 1;
}

.enumlist-search {
  flex: 1;
  min-width: 60px;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
  background: transparent;
  padding: 0.1rem 0;
  color: var(--gray-800);
}

.enumlist-arrow {
  font-size: 0.7rem;
  color: var(--gray-400);
  margin-left: auto;
  padding-left: 0.3rem;
}

.enumlist-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin-top: 2px;
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
}

.enumlist-dropdown.open {
  display: block;
}

.enumlist-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--gray-700);
  transition: background 0.15s;
}

.enumlist-option:hover {
  background: var(--gray-50);
}

.enumlist-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.enumlist-option span {
  flex: 1;
}

/* ── App Launcher ── */
.apps-container {
  max-width: 720px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  text-decoration: none !important;
  transition: all var(--transition);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.app-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--app-color, var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--app-color, var(--primary));
}

.app-card:active {
  transform: translateY(-1px);
}

.app-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.app-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
}

.app-desc {
  font-size: 0.78rem;
  color: var(--gray-500);
  line-height: 1.4;
}

.app-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--app-color, var(--primary));
  color: #fff;
}

[data-theme="dark"] .app-card {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

[data-theme="dark"] .app-card:hover {
  border-color: var(--app-color, var(--primary));
  background: rgba(255, 255, 255, 0.04);
}

/* ── Sidebar ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 101;
  width: 280px;
  max-width: 85vw;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
}

.sidebar-user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.sidebar-user-role {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: capitalize;
}

.sidebar-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-400);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.sidebar-section {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  padding: 0.75rem 1rem 0.35rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  text-decoration: none;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--primary-bg);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-footer {
  padding: 0.75rem 0;
  border-top: 1px solid var(--gray-200);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-500);
  text-decoration: none;
  transition: all var(--transition);
}

.sidebar-footer a:hover {
  background: var(--danger-bg);
  color: var(--danger);
  text-decoration: none;
}

.hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--gray-500);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  line-height: 1;
}

.hamburger:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

[data-theme="dark"] .sidebar {
  background: var(--gray-50);
  border-right-color: var(--gray-200);
}

[data-theme="dark"] .sidebar-header {
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .sidebar-footer {
  border-top-color: var(--gray-200);
}

[data-theme="dark"] .hamburger:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* ── App Layout (Perfex CRM style) ── */
:root {
  --sidebar-width: 250px;
  --sidebar-collapsed: 60px;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  padding: 0 !important;
  justify-content: flex-start !important;
  background: #f4f4f9;
}

[data-theme="dark"] .app-layout {
  background: #0f0f23;
}

.app-layout.has-header {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.app-layout .sidebar-overlay {
  display: none;
}

.app-layout .sidebar {
  transform: translateX(0);
  width: var(--sidebar-width);
  background: #1a1a2e;
  border-right: 1px solid rgba(255,255,255,0.06);
  top: 4px;
  z-index: 99;
}

.app-layout .sidebar-header {
  border-bottom-color: rgba(255,255,255,0.06);
  padding: 1rem;
}

.app-layout .sidebar-user-name {
  color: #fff;
}

.app-layout .sidebar-user-role {
  color: rgba(255,255,255,0.45);
}

.app-layout .sidebar-close {
  display: none;
}

.app-layout .sidebar-nav a {
  color: rgba(255,255,255,0.55);
  border-left: 3px solid transparent;
  font-size: 0.875rem;
  padding: 0.55rem 1rem;
}

.app-layout .sidebar-nav a:hover {
  background: rgba(255,255,255,0.04);
  color: #fff;
}

.app-layout .sidebar-nav a.active {
  background: rgba(79,70,229,0.2);
  color: #fff;
  border-left-color: var(--primary);
}

.app-layout .sidebar-section {
  color: rgba(255,255,255,0.3);
}

.app-layout .sidebar-footer {
  border-top-color: rgba(255,255,255,0.06);
}

.app-layout .sidebar-footer a {
  color: rgba(255,255,255,0.45);
}

.app-layout .sidebar-footer a:hover {
  background: rgba(220,38,38,0.12);
  color: #ef4444;
}

.app-layout .app-header {
  left: var(--sidebar-width);
  right: 0;
  width: auto;
}

.app-layout .header-inner {
  max-width: none;
}

.app-layout .container {
  margin-left: var(--sidebar-width);
  max-width: none !important;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  padding: calc(60px + 1.5rem) 2rem 2rem;
  animation: none;
  flex: 1;
  min-height: 100vh;
}

.app-layout h1 {
  text-align: left;
}

.app-layout h1::after {
  margin: 0.6rem 0 0;
}

/* Dark theme overrides for app-layout sidebar */
[data-theme="dark"] .app-layout .sidebar {
  background: #12121e;
  border-right-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .app-layout .sidebar-header {
  border-bottom-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .app-layout .sidebar-footer {
  border-top-color: rgba(255,255,255,0.04);
}

/* Sidebar collapse */
.app-layout.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

.app-layout.sidebar-collapsed .app-header {
  left: var(--sidebar-collapsed);
}

.app-layout.sidebar-collapsed .container {
  margin-left: var(--sidebar-collapsed);
}

.app-layout.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: 0.6rem 0;
  border-left: none;
}

.app-layout.sidebar-collapsed .sidebar-nav a .nav-label,
.app-layout.sidebar-collapsed .sidebar-section,
.app-layout.sidebar-collapsed .sidebar-footer a .nav-label,
.app-layout.sidebar-collapsed .sidebar-user-info,
.app-layout.sidebar-collapsed .sidebar-header .sidebar-user-info {
  display: none;
}

.app-layout.sidebar-collapsed .sidebar-nav a.active {
  border-left: none;
  position: relative;
}

.app-layout.sidebar-collapsed .sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.app-layout.sidebar-collapsed .sidebar-footer a {
  justify-content: center;
  padding: 0.6rem 0;
}

.app-layout.sidebar-collapsed .sidebar-nav a .nav-label,
.app-layout.sidebar-collapsed .sidebar-section,
.app-layout.sidebar-collapsed .sidebar-footer a .nav-label,
.app-layout.sidebar-collapsed .sidebar-user-info,
.app-layout.sidebar-collapsed .sidebar-header .sidebar-user-info {
  display: none;
}

.app-layout.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: 0.6rem 0;
  border-left: none;
}

.app-layout.sidebar-collapsed .sidebar-nav a.active {
  border-left: none;
  position: relative;
}

.app-layout.sidebar-collapsed .sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.app-layout.sidebar-collapsed .sidebar-footer a {
  justify-content: center;
  padding: 0.6rem 0;
}

.app-layout.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 1rem 0.5rem;
}

.app-layout.sidebar-collapsed .sidebar-user {
  justify-content: center;
}

/* Mobile: revert sidebar to overlay */
@media (max-width: 768px) {
  .app-layout .sidebar-overlay {
    display: block;
  }

  .app-layout .sidebar {
    transform: translateX(-100%);
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    top: 0;
    z-index: 101;
  }

  .app-layout .sidebar.open {
    transform: translateX(0);
  }

  .app-layout .sidebar-user-name { color: var(--gray-900); }
  .app-layout .sidebar-user-role { color: var(--gray-400); }
  .app-layout .sidebar-nav a { color: var(--gray-600); }
  .app-layout .sidebar-nav a:hover { color: var(--primary); background: var(--primary-bg); }
  .app-layout .sidebar-nav a.active { color: var(--primary); background: var(--primary-bg); border-left-color: var(--primary); }
  .app-layout .sidebar-section { color: var(--gray-400); }
  .app-layout .sidebar-footer a { color: var(--gray-500); }
  .app-layout .sidebar-footer a:hover { color: var(--danger); background: var(--danger-bg); }
  .app-layout .sidebar-close { display: flex; }

  .app-layout .app-header {
    left: 0;
    width: 100%;
  }

  .app-layout .container {
    margin-left: 0;
    padding: calc(56px + 1rem) 1rem 1rem;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
  }

  [data-theme="dark"] .app-layout .container {
    background: rgba(26,26,46,0.92);
    border-color: rgba(255,255,255,0.06);
  }
}

/* ── End App Layout ── */

/* ── Link icons ── */
.link-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  display: block;
}

.link-icon-placeholder {
  font-size: 1.4rem;
  line-height: 1;
  display: block;
  text-align: center;
}

/* ── Modal (edit dialog) ── */
.modal {
  background: #fff;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.18s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

[data-theme="dark"] .modal {
  background: var(--gray-50);
}

[data-theme="dark"] .modal-close:hover {
  background: var(--gray-200);
}

/* ── Toggle switch ── */
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.toggle-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--gray-300);
  border-radius: 10px;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle-row input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-row input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

/* ── Home links grid ── */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

.link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition);
  text-align: center;
}

.link-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79,70,229,0.1);
  transform: translateY(-2px);
  text-decoration: none;
}

.link-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  object-fit: cover;
}

.link-card-icon.placeholder {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.2;
}

.link-card-desc {
  font-size: 0.74rem;
  color: var(--gray-400);
  line-height: 1.3;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 1.5rem 0 0.25rem;
  color: var(--gray-700);
}

/* ── Sheet viewer toolbar ── */
.sheet-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sheet-toolbar h1 {
  flex: 1;
  font-size: 1.15rem;
  margin: 0;
}

.sheet-toolbar .btn-link {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  white-space: nowrap;
}

/* ── Column picker ── */
.col-row {
  display: grid;
  grid-template-columns: 140px 110px 130px 1fr 1fr 40px 30px;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--gray-100);
}

.col-row:last-child {
  border-bottom: none;
}

.col-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.5rem;
  border-bottom: none;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.col-header span {
  font-weight: 700;
  border: none;
  background: none;
  padding: 0;
  min-width: 0;
  color: #fff;
}

.col-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}

.col-type {
  font-size: 0.76rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--gray-700);
  min-width: 90px;
  cursor: pointer;
}

.col-visibility {
  font-size: 0.76rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--gray-700);
  min-width: 110px;
  cursor: pointer;
}

.col-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem 0;
}

.col-actions .btn-link {
  font-size: 0.78rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

.col-actions .btn-link:hover {
  color: var(--primary-dark);
}

.col-ref-config {
  display: flex;
  align-items: center;
}

.col-ref-list {
  font-size: 0.76rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--gray-700);
  min-width: 120px;
  cursor: pointer;
}

[data-theme="dark"] .col-ref-list {
  background: var(--gray-50);
  border-color: var(--gray-200);
  color: var(--gray-100);
}

.col-gear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem;
  opacity: 0.4;
  transition: opacity 0.15s;
  line-height: 1;
}

.col-gear:hover {
  opacity: 1;
}

.col-page-label {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.col-page-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.col-dn-input {
  font-size: 0.76rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  background: var(--gray-50);
  color: var(--gray-700);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.col-dn-input:focus {
  background: #fff;
  border-color: var(--primary);
  outline: none;
}

[data-theme="dark"] .col-dn-input {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-50);
}

[data-theme="dark"] .col-dn-input:focus {
  background: var(--gray-50);
  border-color: var(--primary);
}

/* ── Bottom sheet ── */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.bottom-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60vh;
  background: var(--gray-50);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-300);
  margin: 0.5rem auto 0;
  flex-shrink: 0;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.5rem;
  flex-shrink: 0;
}

.bottom-sheet-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.bottom-sheet-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gray-400);
  padding: 0.2rem;
  line-height: 1;
}

.bottom-sheet-body {
  padding: 0.5rem 1rem 1rem;
  overflow-y: auto;
  flex: 1;
}

.bottom-sheet-body .form-group {
  margin-bottom: 0.75rem;
}

.bottom-sheet-body label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: block;
  margin-bottom: 0.25rem;
}

.bottom-sheet-body .form-control {
  width: 100%;
  font-size: 0.88rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--gray-700);
}

.bottom-sheet-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.bottom-sheet-footer .btn-primary {
  flex: 1;
}

[data-theme="dark"] .bottom-sheet {
  background: var(--gray-50);
}

[data-theme="dark"] .bottom-sheet-body .form-control {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-100);
}

/* ── Cell type styles ── */
td.cell-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.cell-date {
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
}

td.cell-long_text {
  max-width: 300px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}

td.cell-enum {
  white-space: nowrap;
}

td.cell-enum_list,
td.cell-list,
td.cell-reference {
  white-space: nowrap;
}

.cell-enum .enum-badge,
.cell-enum_list .enum-badge,
.cell-list .enum-badge,
.cell-reference .enum-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-bg);
  color: var(--primary);
  margin: 0.1rem 0.15rem;
}

.cell-link {
  color: var(--primary);
  text-decoration: underline;
  word-break: break-all;
}

.cell-link:hover {
  color: var(--primary-dark);
}

.cell-image {
  max-width: 120px;
  max-height: 80px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  display: block;
}

td.cell-address {
  white-space: pre-wrap;
  max-width: 250px;
  line-height: 1.4;
}

td.cell-boolean {
  text-align: center;
  white-space: nowrap;
}

.bool-true {
  color: var(--success);
  font-weight: 700;
  font-size: 1.1rem;
}

.bool-false {
  color: var(--danger);
  font-weight: 700;
  font-size: 1.1rem;
}

[data-theme="dark"] .link-card {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

[data-theme="dark"] .link-card:hover {
  border-color: var(--primary);
}

[data-theme="dark"] .section-title {
  color: var(--gray-100);
}

[data-theme="dark"] .col-type,
[data-theme="dark"] .col-visibility {
  background: var(--gray-50);
  border-color: var(--gray-200);
  color: var(--gray-100);
}

/* ── Record cards (profile-style sheet viewer) ── */
.record-count {
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-bottom: 1rem;
}

.record-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.record-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.record-card-header {
  padding: 0.6rem 1rem;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.record-card-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.record-field {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

.record-field-label {
  flex-shrink: 0;
  min-width: 110px;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.record-field-value {
  color: var(--gray-800);
  word-break: break-word;
}

.record-field-value .enum-badge {
  display: inline-block;
}

.record-field-value .cell-image {
  max-width: 100px;
  max-height: 60px;
}

.record-field-value.cell-address {
  white-space: pre-wrap;
  line-height: 1.4;
}

.record-field-value.cell-boolean {
  font-size: 1rem;
}

[data-theme="dark"] .record-card {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

[data-theme="dark"] .record-card-header {
  background: rgba(255,255,255,0.03);
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .record-field-value {
  color: var(--gray-100);
}

/* ── Side sheet (slide from right) ── */
.side-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.side-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.side-sheet {
  position: fixed;
  top: 0;
  right: -560px;
  width: 540px;
  max-width: 100vw;
  height: 100vh;
  z-index: 1001;
  background: var(--gray-50);
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.side-sheet.open {
  right: 0;
}

.side-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  background: var(--gray-50);
  z-index: 1;
}

.side-sheet-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.side-sheet-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.side-sheet-header-info {
  min-width: 0;
}

.side-sheet-header-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-sheet-header-role {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: capitalize;
}

.side-sheet-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--gray-100);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--gray-500);
  transition: all var(--transition);
  flex-shrink: 0;
}

.side-sheet-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.side-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.side-sheet-body::-webkit-scrollbar {
  width: 6px;
}

.side-sheet-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.side-sheet-body .section-divider {
  margin: 1.5rem 0 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-200);
  padding-top: 0.75rem;
}

.side-sheet-body .section-divider:first-of-type {
  margin-top: 0;
}

.side-sheet-body .form-group {
  margin-bottom: 1rem;
}

.side-sheet-body .form-row {
  display: flex;
  gap: 0.75rem;
}

.side-sheet-body .form-row .form-group {
  flex: 1;
}

.side-sheet-body label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.3rem;
}

.side-sheet-body .form-control,
.side-sheet-body input[type="text"],
.side-sheet-body input[type="tel"],
.side-sheet-body input[type="email"],
.side-sheet-body input[type="date"],
.side-sheet-body select,
.side-sheet-body textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  background: #fff;
  transition: all var(--transition);
  color: var(--gray-800);
}

.side-sheet-body input:focus,
.side-sheet-body select:focus,
.side-sheet-body textarea:focus,
.side-sheet-body .form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.side-sheet-body input[readonly] {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}

.side-sheet-footer {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
  background: var(--gray-50);
}

.side-sheet-footer .btn-primary {
  flex: 1;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
}

[data-theme="dark"] .side-sheet {
  background: var(--gray-50);
}

[data-theme="dark"] .side-sheet-header {
  background: var(--gray-50);
}

[data-theme="dark"] .side-sheet-body .form-control,
[data-theme="dark"] .side-sheet-body input[type="text"],
[data-theme="dark"] .side-sheet-body input[type="tel"],
[data-theme="dark"] .side-sheet-body input[type="email"],
[data-theme="dark"] .side-sheet-body input[type="date"],
[data-theme="dark"] .side-sheet-body select,
[data-theme="dark"] .side-sheet-body textarea {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-800);
}

[data-theme="dark"] .side-sheet-body input[readonly] {
  background: var(--gray-200);
  color: var(--gray-500);
}

[data-theme="dark"] .side-sheet-footer {
  background: var(--gray-50);
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 0.84rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pagination-info {
  color: var(--gray-500);
  white-space: nowrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.btn-pagination {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--gray-700);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-pagination:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.btn-pagination.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-pagination.dots {
  border: none;
  background: none;
  color: var(--gray-400);
  cursor: default;
  min-width: 1.5rem;
}

[data-theme="dark"] .pagination-bar {
  background: var(--gray-800);
  border-color: var(--gray-700);
}

[data-theme="dark"] .btn-pagination {
  background: var(--gray-800);
  border-color: var(--gray-700);
  color: var(--gray-300);
}

[data-theme="dark"] .btn-pagination:hover {
  background: var(--gray-700);
}

[data-theme="dark"] .btn-pagination.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

@media (max-width: 640px) {
  .side-sheet {
    width: 100vw;
    right: -100vw;
  }
  .side-sheet-body {
    padding: 1rem;
  }
  .side-sheet-body .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* ── Campus sidebar ── */
.sheet-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.campus-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: calc(60px + 1.5rem);
  box-shadow: var(--shadow);
}

.campus-sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
}

.campus-sidebar-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.campus-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.campus-item {
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.campus-item:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.campus-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.campus-count {
  float: right;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-400);
  background: var(--gray-200);
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  margin-top: 0.1rem;
}

.campus-item.active .campus-count {
  background: var(--primary);
  color: #fff;
}

.campus-filter-mobile {
  display: none;
  width: 100%;
  margin-bottom: 1rem;
}

.sheet-main {
  flex: 1;
  min-width: 0;
}

[data-theme="dark"] .campus-sidebar {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

[data-theme="dark"] .campus-sidebar-header {
  border-bottom-color: var(--gray-200);
}

@media (max-width: 900px) {
  .sheet-layout {
    flex-direction: column;
  }
  .campus-sidebar {
    display: none;
  }
  .campus-filter-mobile {
    display: block;
  }
}

/* ── View Modal (compact & attractive) ── */
.modal-view-box {
  max-width: 560px;
  max-height: 80vh;
}

.modal-view-box .modal-body {
  padding: 0;
}

.vm-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, var(--gray-50), #fff);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 1;
}

.vm-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.vm-title {
  flex: 1;
  min-width: 0;
}

.vm-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.vm-id {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.1rem;
}

.vm-badges {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
}

.vm-badge {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  text-align: center;
}

.vm-badge-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
  margin-bottom: 0.1rem;
}

.vm-badge-value {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-800);
}

.vm-fields {
  padding: 0.25rem 1.5rem;
}

.vm-field {
  display: flex;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.82rem;
}

.vm-field:last-child {
  border-bottom: none;
}

.vm-field-label {
  flex: 0 0 120px;
  color: var(--gray-500);
  font-weight: 500;
}

.vm-field-value {
  flex: 1;
  color: var(--gray-800);
  font-weight: 500;
  word-break: break-word;
}

[data-theme="dark"] .vm-header {
  background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .vm-name {
  color: var(--gray-900);
}

[data-theme="dark"] .vm-badges {
  background: var(--gray-50);
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .vm-badge {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

[data-theme="dark"] .vm-badge-value {
  color: var(--gray-900);
}

[data-theme="dark"] .vm-field-value {
  color: var(--gray-900);
}

/* ── Modal footer (sticky actions) ── */
.modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius) var(--radius);
}

.btn-action {
  flex: 1;
  padding: 0.5rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--gray-700);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  white-space: nowrap;
}

.btn-action:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.btn-action-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-action-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

[data-theme="dark"] .modal-footer {
  background: var(--gray-50);
  border-top-color: var(--gray-200);
}

[data-theme="dark"] .btn-action {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-600);
}

[data-theme="dark"] .btn-action:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .btn-action-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

[data-theme="dark"] .btn-action-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* ── Chip / Tag Input ── */
.chip-input {
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  background: #fff;
  min-height: 2.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  cursor: text;
}

.chip-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.chip-list {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.4rem 0.15rem 0.55rem;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.chip-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  display: inline-flex;
  align-items: center;
  border-radius: 50%;
  transition: background 0.15s;
}

.chip-remove:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.chip-textbox {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.85rem;
  min-width: 120px;
  flex: 1;
  padding: 0.15rem 0;
  color: var(--gray-700);
}

.chip-textbox::placeholder {
  color: var(--gray-400);
}

[data-theme="dark"] .chip-input {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

[data-theme="dark"] .chip-textbox {
  color: var(--gray-600);
}

.chip.table-chip {
  background: var(--gray-200);
  color: var(--gray-700);
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
}

.chip.sheet-source {
  background: #e0e7ff;
  color: #4338ca;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
}

[data-theme="dark"] .chip.sheet-source {
  background: #1e1b4b;
  color: #a5b4fc;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
}

.radio-label:has(input:checked) {
  border-color: var(--primary);
  background: #eef2ff;
  color: var(--primary);
}

[data-theme="dark"] .radio-label {
  background: var(--gray-50);
}

[data-theme="dark"] .radio-label:has(input:checked) {
  background: #1e1b4b;
  border-color: #6366f1;
}

[data-theme="dark"] .chip.table-chip {
  background: var(--gray-100);
  color: var(--gray-600);
}

[data-theme="dark"] .settings-tabs {
  background: rgba(26,26,36,0.85);
}

[data-theme="dark"] .settings-tabs.is-sticky {
  border-bottom-color: var(--gray-200);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
