:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --line: #d9dde5;
  --primary: #1a73e8;
  --primary-dark: #155ab6;
  --success: #28a745;
  --danger: #d93025;
  --surface: #e8edf5;
  --shadow: 0 10px 30px rgba(25, 39, 65, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

.hidden {
  display: none !important;
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary {
  background: var(--surface);
  color: var(--text);
}

button.secondary:hover {
  background: #dce4f0;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.sidebar {
  background: #172033;
  color: #fff;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.brand-mark.large {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 26px;
}

.login-card p {
  margin: -6px 0 8px;
  text-align: center;
  color: var(--muted);
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.login-error.neutral {
  color: var(--muted);
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tab-button {
  background: var(--surface);
  color: var(--text);
}

.tab-button.active {
  background: var(--primary);
  color: #fff;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.demo-users {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.brand-block h1 {
  margin: 0;
  font-size: 18px;
}

.brand-block p,
.status-card p,
.panel-head p,
.eyebrow {
  margin: 0;
  color: var(--muted);
}

.sidebar .brand-block p,
.sidebar .status-card p {
  color: #b8c1cc;
}

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

.nav-button {
  width: 100%;
  background: transparent;
  color: #d7deea;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.nav-button.active,
.nav-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.status-card {
  margin-top: auto;
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--success);
}

.main {
  padding: 22px;
}

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

.topbar h2 {
  margin: 2px 0 0;
  font-size: 25px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.user-panel {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-panel span {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  font-weight: 700;
}

.user-panel select {
  width: 130px;
}

.user-panel input {
  width: 210px;
}

.admin-only,
.branch-only {
  display: none;
}

.is-admin .admin-only,
.is-branch .branch-only {
  display: block;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel.narrow {
  max-width: 720px;
}

.panel-head {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
}

.panel-head.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel h3 {
  margin: 0;
  font-size: 18px;
}

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

.vehicle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 16px;
  align-items: start;
}

.logo-box {
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  padding: 12px;
}

.logo-box img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.panel-head.compact {
  margin-top: 18px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.actions.inline {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.actions.inline button {
  min-height: 34px;
  padding: 0 10px;
}

.summary-box {
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 14px;
  color: var(--muted);
  white-space: pre-wrap;
}

.summary-box.small {
  min-height: 90px;
  margin-top: 14px;
}

.sale-link {
  display: block;
  min-height: 38px;
  overflow-wrap: anywhere;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 10px;
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.request-item.seen {
  background: #fff8df;
  border-color: #f1d27a;
}

.request-item.delivered {
  background: #e8f7ed;
  border-color: #99d6aa;
}

.request-item strong {
  display: block;
  margin-bottom: 4px;
}

.request-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

  .sidebar {
    min-height: auto;
  }

  .split-grid,
  .form-grid,
  .vehicle-layout {
    grid-template-columns: 1fr;
  }

  .topbar,
  .user-panel,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .user-panel input,
  .user-panel select {
    width: 100%;
  }
}
