:root {
  --navy-950: #071425;
  --navy-900: #0a2342;
  --navy-800: #123d68;
  --blue-700: #115ea8;
  --blue-100: #e9f3ff;
  --teal-600: #087f8c;
  --gold-500: #d49b12;
  --green-600: #16865c;
  --ink: #172033;
  --muted: #617085;
  --surface: #ffffff;
  --surface-low: #f3f6fa;
  --background: #eef3f8;
  --line: #d6deea;
  --line-strong: #bdc8d8;
  --shadow: 0 18px 44px rgba(22, 32, 51, 0.12);
  --shadow-soft: 0 8px 24px rgba(22, 32, 51, 0.08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% -10%, rgba(17, 94, 168, 0.18), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0, var(--background) 36rem);
  -webkit-font-smoothing: antialiased;
}

body.dark-mode {
  --ink: #e8eef8;
  --muted: #a7b4c6;
  --surface: #111d2e;
  --surface-low: #17263a;
  --background: #08111f;
  --line: #27384f;
  --line-strong: #3a4d67;
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
  background:
    radial-gradient(circle at 78% -10%, rgba(8, 127, 140, 0.2), transparent 30rem),
    linear-gradient(180deg, #0b1727 0, var(--background) 38rem);
}

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

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #8cc8ff;
  outline-offset: 2px;
}

.command-sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: 260px;
  flex-direction: column;
  padding: 20px 14px;
  color: #fff;
  background: linear-gradient(180deg, var(--navy-950), #0d3159);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 18px 0 48px rgba(7, 20, 37, 0.2);
}

.command-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 24px;
}

.command-brand img {
  width: 45px;
  height: 45px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.command-brand span {
  display: grid;
  gap: 3px;
}

.command-brand strong {
  font-size: 15px;
}

.command-brand small {
  color: #b8cbe2;
  font-size: 10px;
}

.command-sidebar nav {
  display: grid;
  gap: 6px;
}

.command-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 10px 12px;
  color: #c7d5e7;
  font-size: 12px;
  font-weight: 750;
  border: 1px solid transparent;
  border-radius: 8px;
}

.command-sidebar nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.command-sidebar nav a.active {
  color: #071425;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

.command-sidebar nav svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sidebar-footer {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 18px 10px 2px;
  color: #dbe8f7;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-footer span,
.secure-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-footer span {
  font-size: 11px;
  font-weight: 800;
}

.sidebar-footer i,
.secure-status i {
  width: 8px;
  height: 8px;
  background: var(--green-600);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(22, 134, 92, 0.16);
}

.sidebar-footer small {
  color: #9db2c9;
  font-size: 9px;
}

.command-shell {
  min-height: 100vh;
  margin-left: 260px;
}

.command-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(250px, 460px) 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: 66px;
  padding: 10px 28px;
  background: rgba(248, 251, 255, 0.86);
  border-bottom: 1px solid rgba(214, 222, 234, 0.86);
  backdrop-filter: blur(14px);
}

body.dark-mode .command-topbar {
  background: rgba(11, 23, 39, 0.86);
  border-bottom-color: var(--line);
}

.command-topbar > strong {
  color: var(--navy-900);
  font-size: 15px;
}

body.dark-mode .command-topbar > strong {
  color: #f4f8ff;
}

.mobile-menu {
  display: none;
}

.command-search {
  position: relative;
}

.command-search svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #6c7685;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  transform: translateY(-50%);
}

.command-search input {
  width: 100%;
  min-height: 42px;
  padding: 9px 13px 9px 40px;
  color: var(--ink);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(22, 32, 51, 0.04);
  outline: 0;
}

.secure-status {
  justify-self: end;
  color: var(--green-600);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.command-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 13px;
  color: var(--navy-900);
  font-size: 11px;
  font-weight: 850;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

body.dark-mode .command-theme-toggle {
  color: #eef6ff;
  background: #17263a;
  border-color: var(--line-strong);
  box-shadow: none;
}

.command-content {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 24px;
}

.command-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: stretch;
  min-height: 310px;
  margin-bottom: 22px;
}

.hero-copy,
.hero-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  align-content: center;
  padding: 38px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(7, 20, 37, 0.94), rgba(10, 35, 66, 0.86)),
    url("brief-builder-logo.png") right 30px center / 220px no-repeat,
    var(--navy-950);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-copy .eyebrow {
  color: #9fdcff;
}

.hero-copy h1 {
  max-width: 670px;
  margin: 0;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 590px;
  margin: 14px 0 0;
  color: #d4e2f1;
  font-size: 14px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 850;
  border-radius: 8px;
}

.primary-action {
  gap: 9px;
  color: var(--navy-950);
  background: #fff;
}

.primary-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.secondary-action {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.hero-panel {
  display: grid;
  align-content: stretch;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
}

.matter-card {
  display: grid;
  align-content: end;
  min-height: 178px;
  padding: 20px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(8, 127, 140, 0.15), rgba(8, 127, 140, 0)),
    var(--navy-900);
  border-radius: 8px;
}

.matter-label {
  width: fit-content;
  margin-bottom: 48px;
  padding: 6px 9px;
  color: #d6f5f8;
  font-size: 10px;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.matter-card strong {
  font-size: 18px;
  line-height: 1.25;
}

.matter-card p {
  margin: 7px 0 0;
  color: #c9d8ea;
  font-size: 11px;
  line-height: 1.45;
}

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

.stat-grid span {
  display: grid;
  gap: 4px;
  min-height: 78px;
  align-content: center;
  padding: 12px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-grid strong {
  color: var(--navy-900);
  font-size: 22px;
  line-height: 1;
}

body.dark-mode .stat-grid strong {
  color: #f4f8ff;
}

.stat-grid small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.workspace-cards {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
}

.workspace-card {
  display: grid;
  align-content: start;
  min-height: 232px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.17s ease, box-shadow 0.17s ease, transform 0.17s ease;
}

.workspace-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.workspace-card.featured {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

body.dark-mode .workspace-card.featured {
  background: linear-gradient(180deg, #132136, #111d2e);
}

.workspace-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--navy-900);
  background: var(--blue-100);
  border-radius: 8px;
}

.workspace-icon.teal {
  color: var(--teal-600);
  background: #e6f7f8;
}

.workspace-icon.gold {
  color: #7a5300;
  background: #fff3d1;
}

body.dark-mode .workspace-icon.teal {
  background: #14363e;
}

body.dark-mode .workspace-icon.gold {
  color: #ffd97a;
  background: #3c3118;
}

.workspace-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.workspace-meta {
  margin-top: 18px;
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.workspace-card h2 {
  margin: 7px 0 7px;
  color: var(--navy-900);
  font-size: 19px;
  line-height: 1.25;
}

body.dark-mode .workspace-card h2 {
  color: #f4f8ff;
}

.workspace-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.workspace-link {
  align-self: end;
  margin-top: 22px;
  color: var(--navy-800);
  font-size: 11px;
  font-weight: 900;
}

body.dark-mode .workspace-link {
  color: #9fdcff;
}

.secure-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 22px;
  color: #fff;
  background: linear-gradient(90deg, var(--navy-900), #0e5260);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.shield-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.shield-icon svg {
  width: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.secure-banner h2 {
  margin: 0 0 5px;
  font-size: 16px;
}

.secure-banner p {
  margin: 0;
  color: #d5e5f1;
  font-size: 11px;
  line-height: 1.5;
}

.secure-pill {
  padding: 9px 12px;
  color: var(--navy-900);
  font-size: 10px;
  font-weight: 900;
  background: #fff;
  border-radius: 8px;
  white-space: nowrap;
}

.command-section {
  margin-top: 28px;
}

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

.command-section h2 {
  margin: 0;
  color: var(--navy-900);
  font-size: 18px;
}

body.dark-mode .command-section h2 {
  color: #f4f8ff;
}

.command-section header > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.utility-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.utility-card:hover {
  border-color: var(--line-strong);
}

.utility-card > span:nth-child(2) {
  display: grid;
  gap: 4px;
}

.utility-card strong {
  color: var(--navy-900);
  font-size: 13px;
}

body.dark-mode .utility-card strong {
  color: #f4f8ff;
}

.utility-card small {
  color: var(--muted);
  font-size: 10px;
}

.utility-card > b {
  color: var(--blue-700);
}

.rego-mini {
  display: grid;
  width: 96px;
  height: 38px;
  place-items: center;
  color: #111;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.08em;
  background: #f7c900;
  border: 3px double #111;
  border-radius: 6px;
}

.recent-table-wrap {
  position: relative;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th {
  padding: 12px 15px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
  background: var(--surface-low);
  border-bottom: 1px solid var(--line);
}

td {
  padding: 13px 15px;
  color: var(--muted);
  font-size: 10px;
  border-top: 1px solid var(--line);
}

tbody tr:first-child td {
  border-top: 0;
}

tbody tr:hover {
  background: rgba(17, 94, 168, 0.04);
}

body.dark-mode tbody tr:hover {
  background: rgba(159, 220, 255, 0.04);
}

.document-name {
  color: var(--ink);
  font-weight: 850;
}

.reference {
  font-family: "Courier Prime", ui-monospace, monospace;
}

.type-chip,
.status-chip {
  display: inline-flex;
  padding: 4px 8px;
  font-weight: 800;
  border-radius: 999px;
}

.type-chip {
  color: var(--navy-800);
  background: var(--blue-100);
}

.status-chip {
  color: #176447;
  background: #e2f5ed;
}

body.dark-mode .status-chip {
  color: #94e8c1;
  background: #16372c;
}

.open-link {
  color: var(--blue-700);
  font-weight: 900;
}

.recent-empty {
  display: grid;
  gap: 5px;
  padding: 32px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.recent-empty strong {
  color: var(--navy-900);
  font-size: 12px;
}

body.dark-mode .recent-empty strong {
  color: #f4f8ff;
}

.command-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 35px;
  padding: 18px 3px 0;
  color: #7f8da0;
  font-size: 9px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1020px) {
  .command-hero {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr);
  }

  .matter-card {
    min-height: 160px;
  }

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

  .workspace-card {
    min-height: 188px;
  }
}

@media (max-width: 900px) {
  .command-sidebar {
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  body.menu-open .command-sidebar {
    transform: translateX(0);
  }

  .command-shell {
    margin-left: 0;
  }

  .command-topbar {
    grid-template-columns: auto auto minmax(160px, 1fr) auto;
    gap: 12px;
  }

  .mobile-menu {
    display: inline-grid;
    width: 40px;
    min-height: 40px;
    place-items: center;
    color: var(--navy-900);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
  }

  .mobile-menu svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
  }

  body.dark-mode .mobile-menu {
    color: #eef6ff;
  }

  .secure-status {
    display: none;
  }
}

@media (max-width: 680px) {
  .command-topbar {
    grid-template-columns: auto 1fr auto;
    min-height: 60px;
    padding: 8px 12px;
  }

  .command-search {
    grid-column: 1 / -1;
    display: none;
  }

  .command-content {
    width: min(100% - 24px, 1180px);
    padding-top: 20px;
  }

  .command-hero {
    min-height: 0;
  }

  .hero-copy {
    min-height: 340px;
    padding: 26px;
    background:
      linear-gradient(90deg, rgba(7, 20, 37, 0.95), rgba(10, 35, 66, 0.9)),
      url("brief-builder-logo.png") right 12px bottom 14px / 130px no-repeat,
      var(--navy-950);
  }

  .hero-copy h1 {
    font-size: 29px;
    line-height: 1.12;
  }

  .hero-copy p {
    font-size: 13px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

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

  .secure-banner {
    grid-template-columns: auto 1fr;
    padding: 18px;
  }

  .secure-pill {
    display: none;
  }

  .utility-card {
    grid-template-columns: auto 1fr;
  }

  .utility-card > b {
    display: none;
  }

  .command-footer {
    display: grid;
    gap: 4px;
  }
}
