:root {
  --bg: #000000;
  --bg-soft: #0b1120;
  --surface: rgba(28, 28, 30, 0.82);
  --surface-strong: rgba(28, 28, 30, 0.94);
  --surface-elevated: rgba(36, 36, 40, 0.92);
  --hairline: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --muted-strong: #c7c7cc;
  --accent: #7c8cff;
  --accent-soft: rgba(124, 140, 255, 0.18);
  --success: #34c759;
  --danger: #ff6b6b;
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 140, 255, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(88, 86, 214, 0.12), transparent 20%),
    linear-gradient(180deg, #020617 0%, #000000 100%);
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.glass-panel,
.glass-soft,
.settings-shell,
.login-panel,
.table-card,
.admin-card,
.permission-card,
.table-row,
.content-row,
.folder-card,
.toast {
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.glass-panel,
.login-panel,
.table-card,
.admin-card,
.permission-card,
.table-row,
.folder-card,
.content-row,
.toast {
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-md);
}

.glass-soft,
.search-shell,
.sidebar-link,
.user-badge,
.pill,
.nav-pill,
.settings-field input,
.settings-field select,
.settings-field textarea {
  background: var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

.login-panel {
  width: min(480px, 100%);
  border-radius: 32px;
  padding: 30px;
}

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

.brand-icon,
.sidebar-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
}

.login-panel h1,
.settings-sidebar h1,
.content-header h2,
.admin-card h3,
.table-card h3 {
  margin: 0;
}

.muted,
.sidebar-meta,
.table-row p,
.permission-card p,
.row-description,
.folder-meta,
.settings-row-copy p {
  color: var(--muted);
}

.form-grid,
.field,
.sidebar-nav,
.sidebar-group,
.sidebar-footer,
.admin-panel-body,
.admin-layout,
.table-list,
.group-stack,
.group-section,
.permissions-grid,
.settings-list {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.field span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
  padding: 14px 16px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(124, 140, 255, 0.44);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.14);
}

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

.error-text {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.full-width {
  width: 100%;
}

.primary-button,
.ghost-button,
.danger-button,
.nav-pill,
.sidebar-link,
.row-menu-trigger,
.folder-card,
.path-button {
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button,
.ghost-button,
.danger-button {
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #6d7cff 0%, #8f7cff 100%);
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.danger-button {
  color: #ffd1d1;
  background: rgba(255, 107, 107, 0.1);
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.sidebar-link:hover,
.nav-pill:hover,
.folder-card:hover,
.path-button:hover {
  transform: translateY(-1px);
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

.settings-shell {
  display: flex;
  min-height: calc(100vh - 44px);
  border-radius: 30px;
  overflow: hidden;
  background: rgba(7, 10, 18, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-lg);
}

.settings-sidebar {
  flex: 0 0 108px;
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 18px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.sidebar-header {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.sidebar-header h1 {
  font-size: 13px;
  letter-spacing: 0.01em;
}

.sidebar-meta {
  margin: 0;
  font-size: 10px;
  line-height: 1.4;
}

.sidebar-group-title {
  margin: 0;
  padding: 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.4);
}

.sidebar-link {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 8px;
  border-radius: 18px;
  position: relative;
  color: var(--muted-strong);
}

.sidebar-link-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sidebar-icon-wrap {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.54);
}

.sidebar-icon-wrap svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-link strong {
  font-size: 10px;
  line-height: 1.2;
}

.sidebar-count {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.42);
}

.sidebar-link.active {
  background: rgba(124, 140, 255, 0.12);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(124, 140, 255, 0.22);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7c8cff, #9f8bff);
  box-shadow: 0 0 12px rgba(124, 140, 255, 0.56);
}

.sidebar-link.active .sidebar-icon-wrap {
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
}

.user-badge {
  border-radius: 18px;
  padding: 12px;
  text-align: center;
}

.settings-content {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 18px;
  padding: 28px;
  overflow: visible;
}

.content-header {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
}

.content-header h2 {
  font-size: clamp(36px, 4vw, 54px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.content-path {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
}

.path-button,
.path-current {
  border-radius: 999px;
  padding: 5px 10px;
}

.path-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
}

.path-current {
  background: rgba(124, 140, 255, 0.14);
  color: #dee2ff;
}

.path-separator {
  color: rgba(255, 255, 255, 0.22);
}

.filter-row {
  width: min(960px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  margin: 0 auto;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 999px;
  padding: 0 18px;
  min-height: 60px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.search-wide {
  flex: 1 1 540px;
  min-width: 0;
}

.search-shell svg {
  width: 20px;
  height: 20px;
  fill: rgba(255, 255, 255, 0.44);
}

.search-shell input {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 16px;
}

.field.compact {
  flex: 0 1 220px;
  min-width: 0;
}

.content-section {
  min-height: 0;
  overflow-y: auto;
  overflow-x: visible;
  padding-right: 4px;
}

.content-list,
.settings-list {
  display: grid;
  gap: 12px;
  overflow: visible;
}

.folder-card,
.content-row,
.table-row,
.permission-card {
  border-radius: 16px;
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  text-align: left;
  color: var(--text);
}

.folder-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.folder-copy strong {
  font-size: 17px;
}

.folder-meta {
  font-size: 13px;
}

.app-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 20px rgba(0, 0, 0, 0.18);
}

.app-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.app-icon-app {
  color: #fff;
  background: linear-gradient(135deg, #5b8cff 0%, #7c8cff 52%, #9a7cff 100%);
}

.app-icon-doc {
  color: #fff;
  background: linear-gradient(135deg, #3f4c6b 0%, #576078 100%);
}

.department-icon {
  color: #fff;
  background: linear-gradient(135deg, #2e3448 0%, #434964 100%);
}

.content-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 84px;
  width: 100%;
  padding: 14px 18px;
  color: var(--text);
  text-decoration: none;
  position: relative;
  transform-origin: left center;
  z-index: 0;
  isolation: isolate;
}

.content-row:hover {
  transform: translateY(-1px) scale(1.003);
  background: rgba(255, 255, 255, 0.055);
  z-index: 24;
}

.row-left,
.row-right,
.settings-row-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.row-right {
  flex-wrap: nowrap;
}

.row-copy,
.settings-row-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.row-left strong,
.settings-row-copy strong {
  font-size: 17px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-description {
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 720px;
}

.row-type-icon {
  color: #fff;
}

.chevron {
  color: rgba(255, 255, 255, 0.34);
  font-size: 24px;
  line-height: 1;
  flex: 0 0 auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-department {
  background: rgba(255, 255, 255, 0.05);
}

.tag-front-desk {
  color: #cfe0ff;
}

.tag-sales {
  color: #d6f3ff;
}

.tag-finance {
  color: #d4f4ff;
}

.tag-hr {
  color: #eedbff;
}

.tag-housekeeping {
  color: #ffe0c7;
}

.nav-pills {
  grid-template-columns: repeat(auto-fit, minmax(148px, max-content));
  justify-content: start;
}

.nav-pill {
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--muted-strong);
}

.nav-pill.active {
  background: rgba(124, 140, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(124, 140, 255, 0.22);
}

.admin-layout {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  align-items: start;
}

.admin-card,
.table-card {
  padding: 18px;
  overflow: visible;
}

.admin-card h3,
.table-card h3 {
  font-size: 18px;
  margin-bottom: 14px;
}

.settings-form-group {
  display: grid;
  gap: 1px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-field {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
}

.settings-field input,
.settings-field select,
.settings-field textarea {
  margin-top: 8px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

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

.group-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.74);
  letter-spacing: 0.02em;
}

.settings-card {
  padding: 16px;
  position: relative;
  z-index: 0;
  overflow: visible;
}

.settings-card-head {
  margin-bottom: 14px;
}

.settings-stack {
  display: grid;
  gap: 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ios-switch {
  position: relative;
  width: 48px;
  height: 28px;
  appearance: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ios-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease;
}

.ios-switch:checked {
  background: var(--success);
}

.ios-switch:checked::before {
  transform: translateX(20px);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  position: relative;
  z-index: 0;
  isolation: isolate;
  overflow: visible;
}

.settings-row-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.user-avatar {
  background: linear-gradient(135deg, #2f3548 0%, #4a5369 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.settings-row-copy p,
.table-row p,
.permission-card p {
  margin: 0;
  font-size: 13px;
}

.row-menu {
  position: relative;
  z-index: 40;
}

.row-menu summary {
  list-style: none;
}

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

.row-menu-trigger {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
  letter-spacing: 0.18em;
}

.row-menu[open] .row-menu-trigger,
.row-menu-trigger:hover {
  background: rgba(124, 140, 255, 0.16);
  color: #fff;
}

.row-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  gap: 4px;
  min-width: 140px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(26, 26, 29, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-md);
}

.row-menu-popover button {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.row-menu-popover button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.empty-state {
  padding: 28px;
  text-align: center;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  fill: rgba(255, 255, 255, 0.3);
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 40;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 240px;
  padding: 14px 16px;
  border-radius: 16px;
  color: #fff;
}

.content-row::after {
  content: attr(data-tip);
  position: absolute;
  left: 84px;
  top: calc(100% + 8px);
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(26, 26, 29, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 70;
}

.content-row:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.table-row:has(.row-menu[open]),
.settings-row:has(.row-menu[open]),
.content-row:has(.row-menu[open]),
.permission-card:has(select:focus),
.settings-card:has(select:focus),
.settings-card:has(input:focus),
.settings-card:has(textarea:focus) {
  z-index: 50;
}

@media (max-width: 1100px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .content-row::after {
    display: none;
  }
}

@media (max-width: 980px) {
  .settings-shell {
    flex-direction: column;
    min-height: auto;
  }

  .settings-sidebar {
    flex: 0 0 auto;
    grid-template-columns: 1fr;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

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

  .settings-content {
    padding: 18px;
  }

  .filter-row {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .search-wide,
  .field.compact {
    flex-basis: 100%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100%, calc(100% - 12px));
    padding: 6px 0 16px;
  }

  .settings-shell {
    border-radius: 22px;
  }

  .content-header h2 {
    font-size: 32px;
  }

  .content-row,
  .folder-card,
  .settings-row {
    padding: 14px;
  }

  .row-right .pill {
    display: none;
  }
}
