:root {
  --bg: #0b1018;
  --panel: rgba(18, 25, 38, 0.88);
  --panel-strong: #151e2d;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #8290a6;
  --blue: #6f7cff;
  --blue-soft: rgba(111, 124, 255, 0.15);
  --green: #42d6a4;
  --red: #ff6b7a;
  --yellow: #f5bd58;
  --radius: 20px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 75% 0%, rgba(85, 94, 210, 0.15), transparent 32rem),
    linear-gradient(145deg, #0a0f17, #0d1420 55%, #0b111a);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.16;
  pointer-events: none;
}

.ambient-one {
  top: -180px;
  right: 12%;
  background: #7b61ff;
}

.ambient-two {
  bottom: -220px;
  left: 24%;
  background: #2d8cff;
}

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

.login-card {
  width: min(430px, 100%);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(155deg, rgba(28, 38, 57, 0.95), rgba(14, 20, 31, 0.95));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border-radius: 19px;
  color: white;
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(145deg, #8390ff, #5565ff);
  box-shadow: 0 16px 38px rgba(85, 101, 255, 0.35);
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 14px;
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #717f96;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 15px;
}

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

label {
  display: block;
  margin-bottom: 9px;
  color: #b8c1cf;
  font-size: 13px;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: rgba(8, 13, 21, 0.65);
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

input:focus,
textarea:focus {
  border-color: rgba(111, 124, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(111, 124, 255, 0.12);
}

.password-row {
  position: relative;
  margin-bottom: 14px;
}

.password-row input {
  padding-right: 50px;
}

.password-row .icon-button {
  position: absolute;
  top: 5px;
  right: 5px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.icon-button,
.logout-button,
.nav-item {
  border: 0;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, opacity 0.15s;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.ghost-button:hover,
.icon-button:hover,
.logout-button:hover,
.nav-item:hover {
  transform: translateY(-1px);
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 40px;
  padding: 10px 15px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, #7180ff, #5363f2);
  box-shadow: 0 9px 24px rgba(83, 99, 242, 0.22);
}

.secondary-button,
.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.danger-button {
  color: #ffb2bb;
  background: rgba(255, 77, 96, 0.12);
}

.wide {
  width: 100%;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: transparent;
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #ff8d99;
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: rgba(9, 14, 22, 0.8);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  margin-bottom: 3px;
  font-size: 16px;
}

.brand span {
  color: var(--muted);
  font-size: 11px;
}

nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #97a4b8;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  background: transparent;
}

.nav-item span {
  width: 20px;
  color: #75839b;
  font-size: 18px;
  text-align: center;
}

.nav-item.active {
  color: white;
  background: var(--blue-soft);
}

.nav-item.active span {
  color: #aeb6ff;
}

.logout-button {
  margin-top: auto;
  padding: 11px 12px;
  border-radius: 12px;
  color: #8794a9;
  text-align: left;
  background: transparent;
}

.workspace {
  min-width: 0;
  padding: 28px clamp(20px, 3vw, 44px) 50px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.topbar h1 {
  margin: 0;
}

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

.content {
  display: grid;
  gap: 18px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 15px;
  border: 1px solid rgba(66, 214, 164, 0.2);
  border-radius: 13px;
  color: #a7f2d7;
  background: rgba(66, 214, 164, 0.09);
  font-size: 13px;
}

.notice.error {
  border-color: rgba(255, 107, 122, 0.25);
  color: #ffb0b9;
  background: rgba(255, 107, 122, 0.1);
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(22, 31, 47, 0.9), rgba(16, 23, 35, 0.84));
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.12);
}

.metric-card {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border-radius: 18px;
}

.metric-card .label {
  color: #8e9aaf;
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin: 12px 0 7px;
  font-size: clamp(27px, 3vw, 38px);
  letter-spacing: -0.045em;
}

.metric-card small {
  color: #6f7d93;
}

.metric-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #b8c0ff;
  background: var(--blue-soft);
}

.panel {
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h2,
.panel-head p {
  margin-bottom: 0;
}

.panel-head p {
  font-size: 12px;
}

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

.chart {
  height: 230px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  padding-top: 20px;
}

.bar-group {
  min-width: 5px;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  position: relative;
}

.bar {
  width: 100%;
  min-height: 2px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(to top, #5667f4, #8b96ff);
}

.bar.secondary {
  background: linear-gradient(to top, #1f9c77, #50ddb0);
}

.bar-group:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 3;
  padding: 6px 8px;
  border-radius: 8px;
  color: white;
  background: #080c12;
  font-size: 10px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-box {
  max-width: 360px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #6f7d92;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: #c6cfdd;
}

tr:last-child td {
  border-bottom: 0;
}

.user-cell strong,
.user-cell span {
  display: block;
}

.user-cell span {
  margin-top: 3px;
  color: #75839a;
  font-size: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #aab5ff;
  background: rgba(111, 124, 255, 0.12);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.badge.green {
  color: #8be7c7;
  background: rgba(66, 214, 164, 0.1);
}

.badge.red {
  color: #ff9ba6;
  background: rgba(255, 107, 122, 0.1);
}

.badge.yellow {
  color: #f4cb7f;
  background: rgba(245, 189, 88, 0.1);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.actions button {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #b9c3d2;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.actions button.danger {
  color: #ff9ba6;
  background: rgba(255, 107, 122, 0.08);
}

.empty-state,
.loading-state {
  padding: 48px 20px;
  color: #748198;
  text-align: center;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.setting-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(8, 13, 21, 0.32);
}

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

.setting-card span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--text);
  background: #151e2d;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.58);
}

dialog::backdrop {
  background: rgba(3, 6, 10, 0.72);
  backdrop-filter: blur(8px);
}

.dialog-card {
  padding: 22px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head {
  margin-bottom: 20px;
}

.dialog-head h2 {
  margin-bottom: 0;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.dialog-field + .dialog-field {
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .cards {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    width: 100%;
    height: auto;
    padding: 12px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    padding: 0 0 10px;
  }

  .brand span,
  .logout-button {
    display: none;
  }

  nav {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
    padding: 9px 11px;
  }

  .nav-item span {
    display: none;
  }

  .workspace {
    padding: 22px 14px 40px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions .muted {
    display: none;
  }

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

  .metric-card {
    min-height: 126px;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 28px 22px;
  }

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

  .topbar-actions {
    align-items: flex-end;
  }

  .panel {
    padding: 16px;
  }
}
