:root {
  --primary: #2f6bff;
  --success: #2bb673;
  --assist: #ffb020;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --error: #e53935;
  --warning: #fb8c00;
  --info: #2196f3;
  --ink: #172033;
  --muted: #667085;
  --line: #dfe5ef;
  --sidebar: #eef3fb;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.hidden {
  display: none !important;
}

.login-page {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(360px, 1fr);
  min-height: 100vh;
}

.login-brand {
  background:
    radial-gradient(circle at 75% 12%, rgba(255, 255, 255, 0.14), transparent 22%),
    linear-gradient(145deg, #0c44d8, var(--primary));
  color: white;
  display: flex;
  flex-direction: column;
  padding: 36px;
  position: relative;
  overflow: hidden;
}

.brand-lockup,
.sidebar-brand {
  align-items: center;
  display: flex;
  gap: 10px;
}

.brand-lockup img,
.sidebar-brand img {
  height: 36px;
  width: 36px;
}

.brand-lockup strong,
.sidebar-brand strong {
  display: block;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.brand-lockup span,
.sidebar-brand span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.login-claim {
  margin: auto 0;
  max-width: 560px;
}

.eyebrow {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-claim h1 {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 650;
  line-height: 0.95;
  margin: 0 0 22px;
}

.login-claim p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
  line-height: 1.6;
}

.feature-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  margin-bottom: 80px;
  max-width: 560px;
}

.feature-grid div {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px;
}

.feature-grid span,
.login-footer {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.login-footer {
  display: flex;
  gap: 28px;
}

.login-main {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 32px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  max-width: 420px;
  padding: 32px;
  width: 100%;
}

.login-card-logo {
  display: none;
  height: 44px;
  margin-bottom: 16px;
}

.login-card h2,
.modal h2 {
  margin: 0 0 8px;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 22px;
}

label {
  color: var(--ink);
  display: grid;
  font-size: 13px;
  font-weight: 500;
  gap: 8px;
  margin-bottom: 16px;
}

input,
button,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  padding: 11px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.16);
  outline: none;
}

button {
  background: var(--primary);
  border: 0;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  font-weight: 550;
  padding: 11px 14px;
}

button.secondary {
  background: #edf2ff;
  color: var(--primary);
}

button.danger {
  background: transparent;
  color: var(--error);
}

.form-error {
  color: var(--error) !important;
  min-height: 20px;
}

.form-message {
  color: var(--muted);
  min-height: 20px;
}

.form-message.success {
  color: var(--success);
}

.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 18px 12px;
}

.sidebar-brand {
  padding: 0 8px 24px;
}

.sidebar-brand span {
  color: var(--muted);
}

.nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.nav button {
  background: transparent;
  color: #344054;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.nav button.active {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--primary);
  color: var(--primary);
}

.nav-tree {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.chevron {
  color: var(--muted);
  display: inline-flex;
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}

.nav-tree[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

.subnav {
  display: grid;
  gap: 2px;
  margin: -1px 0 7px 18px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.subnav.collapsed {
  display: none;
}

.subnav button {
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  padding: 7px 10px;
}

.subnav button.active {
  background: rgba(47, 107, 255, 0.08);
  box-shadow: inset 3px 0 0 var(--primary);
  color: var(--primary);
}

.account {
  position: relative;
}

.account-button {
  align-items: center;
  background: var(--primary);
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  width: 100%;
}

.account-button small {
  color: rgba(255, 255, 255, 0.72);
  display: block;
  font-weight: 400;
}

.avatar {
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.account-menu {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  bottom: 58px;
  box-shadow: var(--shadow);
  left: 0;
  padding: 8px;
  position: absolute;
  right: 0;
  z-index: 4;
}

.account-menu button {
  background: transparent;
  color: var(--ink);
  text-align: left;
  width: 100%;
}

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

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 360px;
  padding: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 220px;
  padding: 14px;
}

.content {
  min-height: calc(100vh - 130px);
}

.item {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.item strong {
  display: block;
}

.item-badges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

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

.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  border-radius: 14px;
  padding: 16px;
}

.table-wrap {
  overflow: auto;
}

.locations-table {
  border-collapse: collapse;
  width: 100%;
}

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

.locations-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.row-actions button {
  font-size: 12px;
  padding: 7px 9px;
  white-space: nowrap;
}

.locations-table .col-actions {
  text-align: right;
}

.locations-section {
  margin-top: 16px;
}

.tab-bar {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  margin-top: 18px;
  margin-bottom: 14px;
}

.tab-bar button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  padding: 9px 14px;
  cursor: pointer;
}

.tab-bar button.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.button-like {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 550;
  padding: 7px 9px;
  text-decoration: none;
  white-space: nowrap;
}

.button-like:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#account-form details {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
}

#account-form details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}

#account-form details[open] summary {
  margin-bottom: 8px;
}

.account-numbers {
  border-top: 1px dashed var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.template-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 12px;
  margin-bottom: 10px;
}

.template-settings {
  background: #f5f7fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.form-message.success {
  color: #1d8b57;
}

.badge {
  background: #edf2ff;
  border-radius: 999px;
  color: var(--primary);
  display: inline-flex;
  font-size: 12px;
  font-weight: 550;
  padding: 3px 8px;
}

.badge.success {
  background: rgba(43, 182, 115, 0.12);
  color: #1d8b57;
}

.badge.muted {
  background: #eef2f7;
  color: var(--muted);
}

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

.toolbar button {
  white-space: nowrap;
}

h1,
h2,
h3 {
  font-weight: 620;
  letter-spacing: -0.025em;
}

pre {
  background: #101b1f;
  border-radius: 12px;
  color: #d9f0f4;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.modal {
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow);
  max-width: 420px;
  padding: 0;
  width: calc(100% - 32px);
}

.modal.wide {
  max-width: 720px;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.modal form {
  padding: 28px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

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

.check-row input {
  width: auto;
}

@media (max-width: 980px) {
  .login-page,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-card-logo {
    display: block;
  }

  .sidebar {
    min-height: auto;
  }

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