:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d9e2ec;
  --text: #0f172a;
  --muted: #64748b;

  /* OrangeStreet brand tones */
  --accent: #e36c0a;
  --accent-dark: #c55c08;
  --accent-soft: #fff4eb;

  --success-bg: #ecfdf5;
  --success-text: #166534;
  --warn-bg: #fffbeb;
  --warn-text: #b45309;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;

  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

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

/* =========================
   APP SHELL
========================= */

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

.sidebar {
  background: #111827;
  color: #e5e7eb;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 8px 18px rgba(227, 108, 10, 0.28);
}

.brand-copy h1,
.brand-copy h2 {
  margin: 0;
  font-size: 18px;
  color: #fff;
  line-height: 1.1;
}

.brand-copy p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #9ca3af;
}

.nav-group {
  margin-top: 18px;
}

.nav-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 10px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #e5e7eb;
  margin-bottom: 4px;
  transition: background 0.18s ease, color 0.18s ease;
}

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

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 248, 251, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================
   INPUTS / BUTTONS
========================= */

.input,
.select,
.button,
.textarea {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  min-height: 44px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input:focus,
.select:focus,
.textarea:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(227, 108, 10, 0.55);
  box-shadow: 0 0 0 4px rgba(227, 108, 10, 0.10);
}

.button {
  border: none;
  background: #111827;
  color: #fff;
  cursor: pointer;
  padding: 10px 16px;
  font-weight: 600;
}

.button:hover {
  opacity: 0.96;
}

.button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.button.secondary:hover {
  background: var(--panel-soft);
}

.button.accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 18px rgba(227, 108, 10, 0.22);
}

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

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* =========================
   PAGE / SECTION / CARDS
========================= */

.page {
  padding: 24px;
}

.section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-size: 20px;
}

.section-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.cards-4,
.cards-3,
.cards-2 {
  display: grid;
  gap: 16px;
}

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

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-head {
  padding: 18px 20px 0;
}

.card-title {
  margin: 0;
  font-size: 18px;
}

.card-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card-body {
  padding: 20px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}

.metric-foot {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

/* =========================
   TABLES
========================= */

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

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =========================
   PILLS / INFO
========================= */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.pill.high {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #fecaca;
}

.pill.medium {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: #fde68a;
}

.pill.low,
.pill.pending {
  background: var(--panel-soft);
  color: #334155;
  border-color: #cbd5e1;
}

.pill.implement {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #a7f3d0;
}

.pill.ignore {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fdba74;
}

.hero-note,
.empty,
.info-box {
  border: 1px dashed var(--line);
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--muted);
}

.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-item {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

/* =========================
   LOGIN PAGE
========================= */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(227,108,10,0.08), transparent 24%),
    radial-gradient(circle at bottom left, rgba(15,23,42,0.06), transparent 28%),
    var(--bg);
}

.login-card {
  width: min(560px, 100%);
  background: rgba(255,255,255,0.96);
  border: 1px solid #d7dee8;
  border-radius: 30px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.10);
  padding: 34px 36px;
}

.login-brand-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 10px 22px rgba(227, 108, 10, 0.28);
}

.login-brand-copy h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  color: var(--text);
}

.login-brand-copy p {
  margin: 5px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.login-logo-wrap {
  text-align: center;
  margin: 6px 0 24px;
}

.login-logo {
  height: 72px;
  width: auto;
  max-width: 100%;
  display: inline-block;
}

.login-title {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.1;
}

.login-subtitle {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 16px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.login-field label {
  font-size: 14px;
  color: #51637a;
  font-weight: 600;
}

.login-field input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #d5dee8;
  border-radius: 18px;
  background: #fff;
  padding: 0 16px;
  font-size: 16px;
}

.login-field input::placeholder {
  color: #7a8ba0;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.login-actions .button {
  min-height: 52px;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 700;
}

.login-actions .button.secondary {
  background: #fff;
  border: 1px solid #d5dee8;
  color: #6b7280;
  box-shadow: none;
}

.login-actions .button.secondary:hover {
  background: #f8fafc;
}

.footer-note {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}

/* =========================
   RESPONSIVE
========================= */

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

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

  .sidebar {
    position: static;
    height: auto;
  }

  .cards-3,
  .cards-2,
  .split-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
.ai-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: var(--panel-soft);
  color: #334155;
  cursor: pointer;
  min-width: 72px;
}

.ai-btn:hover {
  background: #e2e8f0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal {
  width: min(860px, 100%);
  max-height: 85vh;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  overflow: auto;
  max-height: calc(85vh - 72px);
}

.modal-close {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
}

.preline {
  white-space: pre-line;
  line-height: 1.55;
  font-size: 15px;
}

#aiModalMeta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
  word-break: break-word;
}

#aiModalContent {
  word-break: break-word;
}
/* Match Ask AI button styling for Edit buttons */
.button.secondary.edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: var(--panel-soft);
  color: #334155;
  cursor: pointer;
  min-width: 50px;
  min-height: 26px;
}

.button.secondary.edit-btn:hover {
  background: #ffedd5;
}
@media (max-width: 700px) {
  .page,
  .topbar {
    padding: 18px;
  }

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

  .controls {
    width: 100%;
  }

  .controls > * {
    flex: 1 1 220px;
  }

  .login-card {
    padding: 26px 22px;
    border-radius: 24px;
  }

  .login-logo {
    height: 58px;
  }

  .login-title {
    font-size: 22px;
  }

  .login-subtitle {
    font-size: 15px;
  }
}