:root {
  --bg: #f5f9ff;
  --surface: #ffffff;
  --surface-soft: #eef6ff;
  --text: #102033;
  --muted: #6f7d8d;
  --blue: #0878d8;
  --blue-2: #14a4ff;
  --blue-dark: #0d2d48;
  --sidebar: #101923;
  --sidebar-2: #172635;
  --line: rgba(14, 57, 89, 0.12);
  --shadow: 0 20px 55px rgba(10, 45, 75, 0.14);
  --radius: 24px;
  --danger: #e5484d;
  --success: #10a66a;
  --warning: #db8b00;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, rgba(20, 164, 255, 0.13), transparent 30%), var(--bg);
}

body::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-thumb {
  background: rgba(8, 120, 216, 0.4);
  border-radius: 999px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 286px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(17, 34, 49, 0.96), rgba(8, 14, 22, 0.98)),
    var(--sidebar);
  color: #e9f4ff;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 25px 0 65px rgba(8, 23, 37, 0.28);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 22px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(20, 164, 255, 0.2), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.brand-mark img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-text strong,
.brand-text small {
  display: block;
}

.brand-text strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-text small {
  margin-top: 3px;
  color: rgba(233, 244, 255, 0.58);
  font-size: 12px;
}

.sidebar-close {
  display: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 20px;
}

.nav-item,
.nav-subitem {
  width: 100%;
  border: 0;
  color: rgba(238, 248, 255, 0.82);
  background: transparent;
  display: flex;
  align-items: center;
  text-align: left;
  border-radius: 16px;
  transition: 0.22s ease;
}

.nav-item {
  gap: 12px;
  padding: 12px 14px;
  font-weight: 600;
}

.nav-item i:first-child {
  color: rgba(20, 164, 255, 0.9);
  font-size: 20px;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(8, 120, 216, 0.32), rgba(20, 164, 255, 0.1));
  box-shadow: inset 0 0 0 1px rgba(20, 164, 255, 0.16);
}

.nav-toggle {
  justify-content: flex-start;
}

.nav-arrow {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.nav-group.open .nav-arrow {
  transform: rotate(180deg);
}

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  padding-left: 17px;
  transition: max-height 0.28s ease;
}

.nav-group.open .nav-submenu {
  max-height: 500px;
}

.nav-subitem {
  position: relative;
  margin: 4px 0;
  padding: 9px 12px 9px 26px;
  font-size: 14px;
}

.nav-subitem::before {
  content: '';
  position: absolute;
  left: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(20, 164, 255, 0.5);
}

.nav-subitem:hover,
.nav-subitem.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-divider {
  height: 1px;
  margin: 16px 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  margin: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.user-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
}

.user-avatar.small {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  font-size: 14px;
}

.user-info strong,
.user-info small {
  display: block;
}

.user-info small {
  color: rgba(233, 244, 255, 0.58);
  margin-top: 3px;
}

.main-content {
  width: calc(100% - 286px);
  min-height: 100vh;
  margin-left: 286px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 30px;
  background: rgba(245, 249, 255, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.topbar-title span,
.topbar-title small {
  display: block;
}

.topbar-title span {
  font-weight: 800;
  letter-spacing: -0.03em;
}

.topbar-title small {
  color: var(--muted);
  margin-top: 2px;
}

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

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}

.mobile-menu {
  display: none;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  gap: 4px;
  border-radius: 14px;
  background: rgba(8, 120, 216, 0.08);
  border: 1px solid rgba(8, 120, 216, 0.12);
}

.language-switch a {
  min-width: 42px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  transition: 0.2s ease;
}

.language-switch a.active,
.language-switch a:hover {
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

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

.btn-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
  box-shadow: 0 14px 30px rgba(8, 120, 216, 0.28);
}

.btn-secondary {
  color: var(--blue-dark);
  background: #e6f4ff;
  box-shadow: inset 0 0 0 1px rgba(8, 120, 216, 0.12);
}

.btn-ghost {
  color: var(--blue-dark);
  background: var(--surface);
  border: 1px solid var(--line);
}

.btn-muted {
  color: var(--muted);
  background: #edf3fa;
}

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

.btn-full {
  width: 100%;
}

.hero,
.page-hero {
  position: relative;
  overflow: hidden;
}

.hero-dashboard {
  min-height: 390px;
  display: flex;
  align-items: flex-end;
  margin: 28px;
  border-radius: 34px;
  color: #fff;
  background-image: url('/assets/trucks-main.png');
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 18%, rgba(20, 164, 255, 0.35), transparent 26%),
    linear-gradient(90deg, rgba(5, 18, 30, 0.92), rgba(5, 18, 30, 0.6) 45%, rgba(5, 18, 30, 0.16));
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  padding: 54px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue-2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.hero h1,
.page-hero h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 82px);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 800;
}

.hero-content p:not(.eyebrow),
.page-hero p:not(.eyebrow) {
  max-width: 650px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.65;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-stats span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
}

.content-section,
.admin-header,
.admin-grid,
.admin-card {
  margin: 28px;
}

.section-heading,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2,
.admin-header h1,
.admin-card h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: -0.05em;
}

.admin-header p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--muted);
}

.dashboard-grid,
.link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.section-card,
.doc-card,
.empty-state,
.admin-card,
.login-box {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(8, 120, 216, 0.1);
  box-shadow: var(--shadow);
}

.section-card {
  min-height: 335px;
  display: flex;
  flex-direction: column;
  transform: translateY(0);
}

.section-card:hover {
  transform: translateY(-6px);
}

.section-card-image,
.doc-card-image {
  height: 130px;
  background-size: cover;
  background-position: center;
  filter: saturate(1.05);
}

.section-card-image::after,
.doc-card-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 25, 41, 0.05), rgba(8, 25, 41, 0.75));
  pointer-events: none;
}

.section-card-content,
.doc-card-body {
  position: relative;
  z-index: 1;
  padding: 24px;
}

.section-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-top: -50px;
  margin-bottom: 14px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
  box-shadow: 0 18px 32px rgba(8, 120, 216, 0.26);
  font-size: 25px;
}

.section-icon.small-icon {
  width: 44px;
  height: 44px;
  margin: 0;
  font-size: 20px;
  border-radius: 15px;
}

.section-card h3,
.doc-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.section-card p,
.doc-card p,
.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--blue);
  font-weight: 800;
}

.page-hero {
  height: 280px;
  display: grid;
  place-items: center;
  margin: 28px;
  border-radius: 34px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(8, 18, 28, 0.96), rgba(15, 55, 78, 0.9)),
    url('/assets/trucks-alt.png') center / cover;
  box-shadow: var(--shadow);
}

.page-hero-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background:
    linear-gradient(120deg, transparent 0 28%, rgba(255, 255, 255, 0.08) 28% 38%, transparent 38% 100%),
    radial-gradient(circle at 80% 20%, rgba(20, 164, 255, 0.38), transparent 22%);
}

.page-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px;
}

.page-hero-content p:not(.eyebrow) {
  margin-left: auto;
  margin-right: auto;
}

.page-content-section {
  min-height: 420px;
}

.doc-card {
  min-height: 310px;
}

.doc-card .btn {
  margin-top: 20px;
}

.empty-state {
  min-height: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 26px;
  text-align: center;
}

.empty-icon {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
  box-shadow: 0 18px 40px rgba(8, 120, 216, 0.25);
  font-size: 42px;
}

.empty-state h1,
.empty-state h2 {
  margin: 22px 0 12px;
  letter-spacing: -0.05em;
}

.empty-note {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--muted);
  background: #edf4fb;
}

.admin-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  align-items: start;
}

.admin-card {
  padding: 24px;
}

.wide-card {
  margin: 0;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-stack label,
.form-grid label,
.url-input {
  display: grid;
  gap: 7px;
}

.form-stack span,
.form-grid span,
.url-input span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 10px 13px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
  border-color: rgba(8, 120, 216, 0.45);
  box-shadow: 0 0 0 4px rgba(8, 120, 216, 0.12);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.table-header span {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.users-list,
.links-list {
  display: grid;
  gap: 12px;
}

.user-row,
.link-row {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfdff;
}

.user-row summary {
  display: grid;
  grid-template-columns: 42px 1fr auto 24px;
  align-items: center;
  gap: 12px;
  padding: 16px;
  list-style: none;
  cursor: pointer;
}

.user-row summary::-webkit-details-marker {
  display: none;
}

.user-row strong,
.user-row small {
  display: block;
}

.user-row small,
.row-meta,
.link-row small {
  color: var(--muted);
}

.edit-user-form {
  padding: 0 16px 16px;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.delete-form {
  padding: 0 16px 16px;
  display: flex;
  justify-content: flex-end;
}

.link-row {
  display: grid;
  grid-template-columns: 280px 1fr 100px auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
}

.link-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.link-row-main strong,
.link-row-main small {
  display: block;
}

.visible-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  color: var(--muted);
  font-weight: 800;
}

.visible-toggle input {
  width: 18px;
  min-height: 18px;
}

.flash {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 28px;
  padding: 13px 48px 13px 16px;
  border-radius: 16px;
  font-weight: 700;
  animation: slideDown 0.25s ease both;
}

.login-box .flash {
  margin: 0 0 16px;
}

.flash-success {
  color: #075f3e;
  background: rgba(16, 166, 106, 0.12);
}

.flash-danger {
  color: #8a1820;
  background: rgba(229, 72, 77, 0.12);
}

.flash-warning {
  color: #835200;
  background: rgba(219, 139, 0, 0.14);
}

.flash-close {
  position: absolute;
  right: 12px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.55);
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  background: #06111d;
}

.login-visual {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 48px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(4, 14, 23, 0.95), rgba(4, 14, 23, 0.36)),
    url('/assets/trucks-main.png') center / cover;
}

.login-glow {
  position: absolute;
  inset: auto 7% 12% auto;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: rgba(20, 164, 255, 0.22);
  filter: blur(70px);
}

.login-brand-card {
  position: absolute;
  top: 34px;
  left: 34px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 800;
}

.login-brand-card img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.login-copy h1 {
  margin: 0;
  font-size: clamp(44px, 6vw, 86px);
  letter-spacing: -0.07em;
  line-height: 0.95;
}

.login-copy p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.76);
  font-size: 18px;
  line-height: 1.7;
}

.login-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.login-pills span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.login-panel {
  position: relative;
  display: grid;
  place-items: center;
  padding: 34px;
  background:
    radial-gradient(circle at top right, rgba(20, 164, 255, 0.18), transparent 36%),
    #f4f9ff;
}

.login-lang {
  position: absolute;
  top: 28px;
  right: 28px;
}

.login-box {
  width: min(430px, 100%);
  padding: 34px;
}

.login-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
  display: block;
  margin-bottom: 18px;
}

.login-box h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.login-box p {
  margin: 8px 0 24px;
  color: var(--muted);
}

.card-animate {
  animation: fadeUp 0.55s ease both;
  animation-delay: var(--delay, 0ms);
}

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

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

@media (max-width: 1180px) {
  .dashboard-grid,
  .link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .wide-card {
    margin: 0;
  }

  .link-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

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

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(4, 14, 23, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-close,
  .mobile-menu {
    display: grid;
  }

  .main-content {
    width: 100%;
    margin-left: 0;
  }

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

  .login-visual {
    min-height: 360px;
  }

  .topbar-actions .btn span {
    display: none;
  }
}

@media (max-width: 700px) {
  .topbar,
  .hero-dashboard,
  .page-hero,
  .content-section,
  .admin-header,
  .admin-grid,
  .admin-card {
    margin-left: 14px;
    margin-right: 14px;
  }

  .topbar {
    height: auto;
    padding: 12px 14px;
  }

  .topbar-title small {
    display: none;
  }

  .hero-dashboard {
    min-height: 420px;
  }

  .hero-content {
    padding: 30px;
  }

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

  .admin-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-row summary {
    grid-template-columns: 42px 1fr 24px;
  }

  .row-meta {
    display: none;
  }

  .login-visual,
  .login-panel {
    padding: 24px;
  }
}

/* ===== V1.1: themes, settings, search, admin dashboard ===== */
body.theme-dark {
  --bg: #07111d;
  --surface: #101b29;
  --surface-soft: #13283d;
  --text: #edf7ff;
  --muted: #9db0c6;
  --blue: #1597ff;
  --blue-2: #55c4ff;
  --blue-dark: #d6efff;
  --line: rgba(174, 214, 255, 0.16);
  --shadow: 0 24px 65px rgba(0, 0, 0, 0.38);
  background: radial-gradient(circle at top right, rgba(21, 151, 255, 0.16), transparent 32%), var(--bg);
}

body.theme-dark .topbar {
  background: rgba(7, 17, 29, 0.78);
}

body.theme-dark .section-card,
body.theme-dark .doc-card,
body.theme-dark .empty-state,
body.theme-dark .admin-card,
body.theme-dark .login-box,
body.theme-dark .document-tile,
body.theme-dark .stat-card,
body.theme-dark .search-card {
  background: rgba(16, 27, 41, 0.9);
  border-color: rgba(174, 214, 255, 0.14);
}

body.theme-dark .user-row,
body.theme-dark .link-row,
body.theme-dark .link-editor-row,
body.theme-dark input,
body.theme-dark select,
body.theme-dark .inline-search,
body.theme-dark .big-search,
body.theme-dark .log-row {
  background: #0c1724;
  color: var(--text);
  border-color: var(--line);
}

body.theme-dark .btn-ghost,
body.theme-dark .icon-btn {
  background: #0f1c2b;
  color: var(--text);
}

body.theme-dark .btn-secondary,
body.theme-dark .btn-muted,
body.theme-dark .empty-note {
  background: rgba(21, 151, 255, 0.14);
  color: #d7efff;
}

body.theme-dark .login-panel {
  background: radial-gradient(circle at top right, rgba(20, 164, 255, 0.16), transparent 36%), #07111d;
}

.theme-toggle-form {
  margin: 0;
}

.theme-toggle i {
  font-size: 20px;
}

.settings-link {
  text-decoration: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.btn-glass {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
}

.card-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: rgba(230, 244, 255, 0.94);
  font-weight: 800;
  font-size: 12px;
}

body.theme-dark .card-badge {
  color: #dff4ff;
  background: rgba(21, 151, 255, 0.2);
  border: 1px solid rgba(85, 196, 255, 0.2);
}

.inline-search,
.big-search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
  padding: 8px 10px 8px 14px;
  box-shadow: 0 10px 30px rgba(10, 45, 75, 0.07);
}

.inline-search input,
.big-search input {
  min-height: 38px;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 4px;
}

.inline-search input:focus,
.big-search input:focus {
  box-shadow: none;
}

.inline-search {
  width: min(380px, 100%);
}

.big-search {
  width: 100%;
}

.search-card {
  margin-top: 0;
}

.compact-heading {
  margin-bottom: 10px;
}

.doc-actions,
.admin-header-actions,
.link-summary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.centered-actions {
  justify-content: center;
  margin-top: 20px;
}

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

.document-tile {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(8, 120, 216, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.document-tile .section-icon {
  margin-top: 0;
}

.document-tile h3 {
  margin: 5px 0 8px;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.document-tile p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.doc-group {
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 900;
}

.settings-grid,
.stats-grid {
  display: grid;
  margin: 28px;
  gap: 22px;
}

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

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

.settings-card-title {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}

.settings-card-title .section-icon {
  flex: 0 0 auto;
}

.settings-card-title h2,
.settings-card-title p {
  margin: 0;
}

.settings-card-title p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.55;
}

.separated-form {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.stat-card {
  min-height: 150px;
  padding: 22px;
  border: 1px solid rgba(8, 120, 216, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.stat-card i {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
  font-size: 22px;
}

.stat-card span,
.stat-card strong {
  display: block;
}

.stat-card span {
  margin-top: 16px;
  color: var(--muted);
  font-weight: 800;
}

.stat-card strong {
  margin-top: 6px;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.admin-warning {
  margin-top: 0;
}

.log-table {
  display: grid;
  gap: 8px;
}

.log-row {
  display: grid;
  grid-template-columns: 110px 1.2fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
  color: var(--muted);
}

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

.log-head {
  color: var(--text);
  font-weight: 900;
  background: var(--surface-soft);
}

.status-pill {
  display: inline-flex;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
}

.status-pill.success {
  color: #086b45;
  background: rgba(16, 166, 106, 0.15);
}

.status-pill.failed {
  color: #9b1c24;
  background: rgba(229, 72, 77, 0.15);
}

body.theme-dark .status-pill.success {
  color: #8cf0c4;
}

body.theme-dark .status-pill.failed {
  color: #ffb6bb;
}

.link-editor-row {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fbfdff;
  overflow: hidden;
}

.link-editor-row summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.link-editor-row summary::-webkit-details-marker {
  display: none;
}

.link-edit-form {
  padding: 0 16px 16px;
}

.full-url-input {
  margin-top: 14px;
}

.between-actions {
  justify-content: space-between;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .log-row {
    grid-template-columns: 110px 1fr 1fr;
  }

  .log-row span:nth-child(4),
  .log-row time {
    display: none;
  }
}

@media (max-width: 700px) {
  .settings-grid,
  .stats-grid {
    margin-left: 14px;
    margin-right: 14px;
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    gap: 6px;
  }

  .settings-link,
  .theme-toggle {
    width: 38px;
    height: 38px;
  }

  .language-switch a {
    min-width: 34px;
    padding: 8px 7px;
  }

  .inline-search,
  .big-search {
    width: 100%;
  }

  .document-tile {
    grid-template-columns: 1fr;
  }

  .log-row {
    grid-template-columns: 1fr;
  }

  .log-row span:nth-child(4),
  .log-row time {
    display: block;
  }

  .link-editor-row summary,
  .admin-header-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ===== V1.2: instant preferences, compact sidebar and polish ===== */
.sidebar,
.main-content,
.brand-text,
.nav-item span,
.nav-arrow,
.nav-submenu,
.user-info,
.sidebar-user {
  transition: width 0.25s ease, margin 0.25s ease, opacity 0.2s ease, transform 0.2s ease, padding 0.2s ease;
}

.sidebar-brand-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-collapse-form,
.theme-toggle-form {
  display: inline-flex;
  margin: 0;
}

.sidebar-collapse {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-collapse:hover,
.sidebar-close:hover {
  background: rgba(20, 164, 255, 0.2);
}

.theme-toggle:disabled,
.sidebar-collapse:disabled {
  opacity: 0.55;
  cursor: wait;
}

body.sidebar-collapsed .sidebar {
  width: 92px;
}

body.sidebar-collapsed .main-content {
  width: calc(100% - 92px);
  margin-left: 92px;
}

body.sidebar-collapsed .sidebar-brand {
  padding-left: 18px;
  padding-right: 18px;
  justify-content: center;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .nav-arrow,
body.sidebar-collapsed .nav-submenu,
body.sidebar-collapsed .user-info {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

body.sidebar-collapsed .brand-link,
body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .sidebar-user {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-nav {
  padding-left: 12px;
  padding-right: 12px;
}

body.sidebar-collapsed .nav-item {
  padding-left: 0;
  padding-right: 0;
  min-height: 48px;
}

body.sidebar-collapsed .nav-group.open .nav-submenu {
  max-height: 0;
}

body.sidebar-collapsed .nav-divider {
  margin-left: 12px;
  margin-right: 12px;
}

body.sidebar-collapsed .sidebar-user {
  padding: 12px;
}

body.sidebar-collapsed .sidebar-brand-actions {
  position: absolute;
  right: 8px;
  top: 8px;
}

body.sidebar-collapsed .sidebar-collapse {
  width: 30px;
  height: 30px;
  border-radius: 11px;
}

.card-animate:hover {
  transform: translateY(-5px);
}

.section-card,
.doc-card,
.document-tile,
.admin-card,
.stat-card,
.empty-state {
  backdrop-filter: blur(14px);
}

body.theme-dark .sidebar-collapse {
  background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .sidebar-collapse:hover {
  background: rgba(21, 151, 255, 0.22);
}

@media (max-width: 920px) {
  body.sidebar-collapsed .sidebar {
    width: 286px;
  }

  body.sidebar-collapsed .main-content {
    width: 100%;
    margin-left: 0;
  }

  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .nav-item span,
  body.sidebar-collapsed .nav-arrow,
  body.sidebar-collapsed .user-info {
    opacity: 1;
    width: auto;
    overflow: visible;
    pointer-events: auto;
  }

  body.sidebar-collapsed .nav-submenu {
    opacity: 1;
    width: auto;
    pointer-events: auto;
  }

  body.sidebar-collapsed .sidebar-brand,
  body.sidebar-collapsed .nav-item,
  body.sidebar-collapsed .sidebar-user {
    justify-content: flex-start;
  }

  body.sidebar-collapsed .sidebar-brand-actions {
    position: static;
  }

  .sidebar-collapse-form {
    display: none;
  }
}

/* ===== V1.3: readable desktop scale, visible light theme, no browser translation of brand ===== */
.notranslate {
  unicode-bidi: isolate;
}

@media (min-width: 921px) {
  .sidebar {
    width: 252px;
  }

  .main-content {
    width: calc(100% - 252px);
    margin-left: 252px;
  }

  .topbar {
    height: 58px;
    padding: 0 24px;
  }

  .topbar-title span {
    font-size: 14px;
    letter-spacing: -0.02em;
  }

  .topbar-title small {
    font-size: 12px;
  }

  .topbar-actions {
    gap: 8px;
  }

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

  .language-switch a {
    min-width: 36px;
    padding: 7px 8px;
    font-size: 12px;
  }

  .btn {
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 13px;
    font-size: 13px;
  }

  .sidebar-brand {
    padding: 16px 16px 14px;
    gap: 10px;
  }

  .brand-link {
    gap: 10px;
    min-width: 0;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 15px;
  }

  .brand-mark img {
    width: 34px;
    height: 34px;
  }

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

  .brand-text strong {
    font-size: 14px;
    line-height: 1.12;
  }

  .brand-text small {
    font-size: 11px;
  }

  .sidebar-nav {
    padding: 6px 12px 16px;
  }

  .nav-item {
    gap: 10px;
    min-height: 41px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
  }

  .nav-item i:first-child {
    font-size: 18px;
  }

  .nav-submenu {
    padding-left: 14px;
  }

  .nav-subitem {
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 13px;
  }

  .nav-divider {
    margin: 12px 6px;
  }

  .sidebar-user {
    margin: 12px;
    padding: 12px;
    border-radius: 17px;
  }

  .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    font-size: 14px;
  }

  .user-info strong {
    font-size: 13px;
  }

  .user-info small {
    font-size: 11px;
  }

  body.sidebar-collapsed .sidebar {
    width: 78px;
  }

  body.sidebar-collapsed .main-content {
    width: calc(100% - 78px);
    margin-left: 78px;
  }

  body.sidebar-collapsed .sidebar-brand {
    padding-left: 12px;
    padding-right: 12px;
  }

  body.sidebar-collapsed .sidebar-nav {
    padding-left: 10px;
    padding-right: 10px;
  }

  body.sidebar-collapsed .nav-item {
    min-height: 44px;
  }
}

.hero-dashboard {
  min-height: 320px;
  margin: 22px;
  border-radius: 28px;
}

.hero-content {
  max-width: 590px;
  padding: 42px;
}

.hero h1,
.page-hero h1 {
  font-size: clamp(36px, 4.6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.hero-content p:not(.eyebrow),
.page-hero p:not(.eyebrow) {
  max-width: 560px;
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.55;
}

.eyebrow {
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.hero-stats {
  gap: 9px;
  margin-top: 22px;
}

.hero-stats span {
  padding: 8px 12px;
  font-size: 13px;
}

.hero-actions {
  margin-top: 18px;
  gap: 10px;
}

.content-section,
.admin-header,
.admin-grid,
.admin-card,
.settings-grid,
.stats-grid {
  margin: 22px;
}

.section-heading h2,
.admin-header h1,
.admin-card h2 {
  font-size: clamp(24px, 2.35vw, 34px);
  letter-spacing: -0.045em;
}

.dashboard-grid,
.link-grid {
  gap: 16px;
  margin-top: 16px;
}

.section-card {
  min-height: 270px;
  border-radius: 22px;
}

.section-card-image,
.doc-card-image {
  height: 110px;
}

.section-card-content,
.doc-card-body {
  padding: 20px;
}

.section-icon {
  width: 48px;
  height: 48px;
  margin-top: -44px;
  margin-bottom: 12px;
  border-radius: 16px;
  font-size: 22px;
}

.section-card h3,
.doc-card h3 {
  font-size: 19px;
  line-height: 1.15;
}

.section-card p,
.doc-card p,
.empty-state p,
.document-tile p {
  font-size: 14px;
  line-height: 1.52;
}

.card-badge {
  top: 16px;
  right: 16px;
  padding: 6px 9px;
  font-size: 11px;
}

.card-link {
  margin-top: 16px;
  font-size: 14px;
}

.inline-search,
.big-search {
  border-radius: 15px;
  padding: 6px 9px 6px 12px;
}

.inline-search input,
.big-search input {
  min-height: 34px;
  font-size: 13px;
}

.page-hero {
  height: 220px;
  margin: 22px;
  border-radius: 28px;
}

.empty-state {
  min-height: 330px;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 23px;
  font-size: 34px;
}

/* Make light theme really look light, not like dark mode with light cards. */
body.theme-light .sidebar {
  color: #17304a;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(237, 247, 255, 0.98)),
    #ffffff;
  border-right: 1px solid rgba(8, 120, 216, 0.14);
  box-shadow: 20px 0 50px rgba(10, 45, 75, 0.08);
}

body.theme-light .brand-mark {
  background: linear-gradient(145deg, rgba(8, 120, 216, 0.12), rgba(20, 164, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(8, 120, 216, 0.12);
}

body.theme-light .brand-text small,
body.theme-light .user-info small {
  color: rgba(23, 48, 74, 0.58);
}

body.theme-light .nav-item,
body.theme-light .nav-subitem {
  color: rgba(23, 48, 74, 0.78);
}

body.theme-light .nav-item i:first-child {
  color: rgba(8, 120, 216, 0.95);
}

body.theme-light .nav-item:hover,
body.theme-light .nav-item.active {
  color: #073557;
  background: linear-gradient(90deg, rgba(8, 120, 216, 0.13), rgba(20, 164, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(8, 120, 216, 0.14);
}

body.theme-light .nav-subitem:hover,
body.theme-light .nav-subitem.active {
  color: #073557;
  background: rgba(8, 120, 216, 0.08);
}

body.theme-light .nav-divider {
  background: rgba(8, 120, 216, 0.12);
}

body.theme-light .sidebar-user {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(8, 120, 216, 0.12);
}

body.theme-light .sidebar-collapse,
body.theme-light .sidebar-close {
  color: #0d2d48;
  background: rgba(8, 120, 216, 0.09);
}

body.theme-light .sidebar-collapse:hover,
body.theme-light .sidebar-close:hover {
  background: rgba(20, 164, 255, 0.18);
}

@media (max-width: 700px) {
  .hero-dashboard {
    min-height: 360px;
  }

  .hero-content {
    padding: 28px;
  }

  .hero h1,
  .page-hero h1 {
    font-size: clamp(34px, 11vw, 48px);
  }
}

/* ===== V1.6: sections, import/export, hosting tools and stable preferences ===== */
textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  box-shadow: 0 0 0 4px rgba(20, 164, 255, 0.14);
  border-color: rgba(20, 164, 255, 0.45);
}

.big-search select {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.divider-line {
  height: 1px;
  margin: 22px 0;
  background: var(--line);
}

.compact-dashboard-grid .section-card {
  min-height: 245px;
}

.recent-section {
  margin-top: 0;
}

.slim-documents-grid .document-tile {
  min-height: auto;
}

.section-link-grid .doc-card {
  color: inherit;
}

.documents-heading {
  margin-top: 28px;
}

.muted-row {
  opacity: 0.72;
}

.link-editor-row summary .link-summary-actions {
  flex: 0 0 auto;
}

.link-editor-row .delete-form,
.user-row .delete-form {
  margin: 14px 0 0;
}

.status-pill.failed,
.status-pill.success {
  white-space: nowrap;
}

.full-log-table .log-row {
  grid-template-columns: 110px 1.2fr 1fr 1fr 1fr 1.4fr;
}

.log-row {
  gap: 12px;
}

.log-row span,
.log-row strong,
.log-row time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-stack textarea + small {
  color: var(--muted);
}

body.theme-dark textarea {
  background: #0c1724;
  color: var(--text);
  border-color: var(--line);
}

body.theme-dark .big-search select {
  color: var(--text);
}

body.theme-dark .big-search select option,
body.theme-dark select option {
  color: #0c1724;
}

body.theme-light .brand-text strong,
body.theme-light .sidebar-user strong {
  color: #17304a;
}

body.theme-light .nav-subitem::before {
  background: rgba(8, 120, 216, 0.42);
}

@media (max-width: 1100px) {
  .full-log-table .log-row {
    grid-template-columns: 100px 1fr 1fr;
  }

  .full-log-table .log-row span:nth-child(4),
  .full-log-table .log-row span:nth-child(5),
  .full-log-table .log-row time {
    display: none;
  }
}

/* ===== V1.7: access control, protected documents, contacts and audit ===== */
.hidden-field {
  display: none !important;
}

.security-notice {
  margin: 0 28px 22px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(8, 120, 216, 0.18);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 90%, var(--blue) 10%);
  box-shadow: 0 12px 34px rgba(10, 45, 75, 0.07);
}

.security-notice > i {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
  font-size: 21px;
}

.security-notice strong,
.security-notice p {
  display: block;
  margin: 0;
}

.security-notice p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.55;
}

.warning-notice {
  border-color: rgba(219, 139, 0, 0.28);
  background: color-mix(in srgb, var(--surface) 91%, #f2ad2e 9%);
}

.warning-notice > i {
  background: linear-gradient(145deg, #d98b00, #f4b740);
}

.info-notice > i {
  background: linear-gradient(145deg, #0878d8, #14a4ff);
}

.form-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-hint i {
  color: var(--blue);
  margin-top: 2px;
}

.user-access-banner {
  margin: 0 16px 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.user-access-banner > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-access-banner > div > i {
  color: var(--blue);
  font-size: 24px;
}

.user-access-banner span,
.user-access-banner strong,
.user-access-banner small {
  display: block;
}

.user-access-banner small {
  margin-top: 3px;
  color: var(--muted);
}

.access-form {
  margin-bottom: 96px;
}

.access-card {
  margin: 0 28px 22px;
  padding: 0;
  overflow: hidden;
}

.access-card .table-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.access-card .table-header h2,
.access-card .table-header p {
  margin: 0;
}

.access-card .table-header p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.table-filter {
  min-width: 260px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface);
}

.permission-list {
  display: grid;
}

.permission-table {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) minmax(130px, 0.7fr) minmax(170px, 0.9fr) minmax(170px, 0.9fr);
  gap: 12px;
  align-items: center;
}

.permission-table-head {
  padding: 11px 20px;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.permission-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.2s ease, background 0.2s ease;
}

.permission-row:last-child {
  border-bottom: 0;
}

.permission-row:hover {
  background: color-mix(in srgb, var(--surface) 94%, var(--blue) 6%);
}

.permission-row.permission-inherit input[type="datetime-local"] {
  opacity: 0.55;
}

.permission-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.permission-label > i {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--blue);
  background: var(--surface-soft);
  font-size: 18px;
}

.permission-label strong,
.permission-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-label small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.permission-row select,
.permission-row input[type="datetime-local"] {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
}

.sticky-save-bar {
  position: fixed;
  z-index: 25;
  left: calc(286px + 28px);
  right: 28px;
  bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 15px 13px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 93%, transparent 7%);
  backdrop-filter: blur(16px);
  box-shadow: 0 22px 50px rgba(8, 30, 50, 0.18);
}

body.sidebar-collapsed .sticky-save-bar {
  left: calc(92px + 28px);
}

.sticky-save-bar strong,
.sticky-save-bar span {
  display: block;
}

.sticky-save-bar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.document-mode-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.protected-file-status {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.protected-file-status > i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--blue);
  background: var(--surface);
  font-size: 21px;
}

.protected-file-status strong,
.protected-file-status small {
  display: block;
}

.protected-file-status small {
  margin-top: 4px;
  color: var(--muted);
}

.google-import-form {
  margin: 12px 16px 0;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.protected-document-card {
  border-color: rgba(8, 120, 216, 0.2);
}

.protected-document-card .doc-group {
  color: #0672c9;
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.contact-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.contact-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
  font-size: 23px;
}

.contact-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.contact-title-row h3,
.contact-title-row span {
  margin: 0;
}

.contact-title-row h3 {
  font-size: 18px;
}

.contact-title-row > div > span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.contact-details {
  margin-top: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.contact-details a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
}

.contact-details a i {
  color: var(--blue);
}

.contact-notes {
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.audit-preview-list {
  display: grid;
  gap: 8px;
}

.audit-preview-row {
  display: grid;
  grid-template-columns: 36px minmax(220px, 1.8fr) minmax(130px, 0.7fr) minmax(160px, 0.8fr);
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.audit-preview-row strong,
.audit-preview-row small {
  display: block;
}

.audit-preview-row small,
.audit-preview-row span,
.audit-preview-row time {
  color: var(--muted);
  font-size: 12px;
}

.tiny-icon {
  width: 34px !important;
  height: 34px !important;
  border-radius: 11px !important;
  font-size: 16px !important;
}

.audit-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.audit-table th,
.audit-table td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.audit-table td {
  color: var(--text);
  font-size: 13px;
}

.audit-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.audit-action {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.audit-details {
  max-width: 330px;
  color: var(--muted) !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px !important;
  overflow-wrap: anywhere;
}

.audit-search select {
  min-width: 210px;
}

.expanded-stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.muted-text {
  color: var(--muted);
}

body.theme-dark .security-notice,
body.theme-dark .user-access-banner,
body.theme-dark .permission-row,
body.theme-dark .permission-row select,
body.theme-dark .permission-row input,
body.theme-dark .sticky-save-bar,
body.theme-dark .document-mode-panel,
body.theme-dark .protected-file-status > i,
body.theme-dark .contact-card,
body.theme-dark .audit-preview-row,
body.theme-dark .table-filter,
body.theme-dark .audit-table td {
  color: var(--text);
  background-color: var(--surface);
}

body.theme-dark .permission-table-head,
body.theme-dark .audit-table th,
body.theme-dark .user-access-banner,
body.theme-dark .document-mode-panel {
  background: var(--surface-soft);
}

@media (max-width: 1280px) {
  .permission-table {
    grid-template-columns: minmax(220px, 1.4fr) minmax(115px, 0.6fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr);
  }

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

@media (max-width: 900px) {
  .contacts-grid,
  .expanded-stats-grid {
    grid-template-columns: 1fr;
  }

  .permission-table-head {
    display: none;
  }

  .permission-table {
    grid-template-columns: 1fr;
  }

  .permission-row {
    padding: 16px;
  }

  .permission-row select,
  .permission-row input[type="datetime-local"] {
    min-height: 44px;
  }

  .sticky-save-bar {
    left: 14px !important;
    right: 14px;
    bottom: 12px;
  }

  .audit-preview-row {
    grid-template-columns: 36px 1fr;
  }

  .audit-preview-row > span,
  .audit-preview-row > time {
    grid-column: 2;
  }

  .google-import-form,
  .user-access-banner {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .security-notice,
  .access-card {
    margin-left: 14px;
    margin-right: 14px;
  }

  .table-filter {
    width: 100%;
    min-width: 0;
  }

  .contact-card {
    grid-template-columns: 1fr;
  }
}
