:root {
  --navy: #06265f;
  --navy-dark: #041946;
  --blue: #0b4ea2;
  --red: #d42027;
  --green: #20a85a;
  --paper: #f5f7fb;
  --white: #ffffff;
  --ink: #172033;
  --muted: #6b7688;
  --line: #dce4ef;
  --soft-blue: #edf3ff;
  --shadow: 0 18px 54px rgba(4, 25, 70, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.login-locked {
  overflow: hidden;
}

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

button,
select,
input[type="file"] {
  cursor: pointer;
}

button,
input,
select,
textarea {
  border-radius: 0;
}

button {
  border: 0;
}

img {
  display: block;
  max-width: 100%;
}

.login-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(4, 25, 70, 0.97), rgba(6, 38, 95, 0.92)),
    var(--navy-dark);
}

.login-screen[hidden] {
  display: none;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 12% 8%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 42px;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 26px;
  width: min(470px, 100%);
  padding: clamp(26px, 5vw, 42px);
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px);
}

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

.login-brand img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
}

.login-brand div {
  display: grid;
  gap: 2px;
}

.login-brand strong {
  font-family: "Roboto Slab", serif;
  font-size: 1.45rem;
  line-height: 1;
}

.login-brand span {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.login-card h1 {
  color: var(--white);
}

.login-copy {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
}

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

.login-form label {
  display: grid;
  gap: 7px;
}

.login-form label span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  outline-color: rgba(255, 255, 255, 0.7);
}

.login-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border-radius: 999px;
}

.login-error {
  margin: 0;
  color: #ffd8da;
  font-size: 0.9rem;
  font-weight: 800;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100svh;
  padding: 24px;
  color: var(--white);
  background: var(--navy-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--white);
  text-decoration: none;
}

.brand-mark {
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.82);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-family: "Roboto Slab", serif;
  font-size: 1.45rem;
  line-height: 1;
}

.brand-copy small {
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

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

.side-nav button,
.top-actions button,
.segmented button,
.tool-grid button,
.file-button,
.record-form footer button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 900;
}

.side-nav button {
  justify-content: flex-start;
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
}

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

.side-nav svg,
.top-actions svg,
.tool-grid svg,
.file-button svg,
.record-form footer svg,
.icon-button svg,
.search svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.sidebar-note {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.sidebar-note span {
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sidebar-note strong {
  font-size: 1.35rem;
  line-height: 1.1;
}

.workspace {
  min-width: 0;
  padding: 28px clamp(18px, 4vw, 44px) 44px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  color: var(--navy-dark);
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.96;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  color: var(--navy-dark);
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  line-height: 1.05;
  text-transform: uppercase;
}

.top-actions,
.toolbar,
.panel-header,
.record-form footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary {
  color: var(--white);
  background: var(--red);
}

.ghost {
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--line);
}

.ghost.dark {
  color: var(--navy-dark);
  background: var(--paper);
}

.danger {
  color: var(--white);
  background: #a51018;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metrics article {
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(6, 38, 95, 0.06);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.metrics strong {
  display: block;
  margin-top: 10px;
  color: var(--navy);
  font-size: 2.2rem;
  line-height: 1;
}

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

.data-panel {
  margin-bottom: 18px;
}

.panel-header {
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  padding-bottom: 18px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  min-width: 255px;
  padding: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.segmented button {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--white);
  background: var(--navy);
}

.toolbar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 240px;
  min-height: 46px;
  padding: 0 13px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
}

.search input {
  width: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

select {
  min-height: 46px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
}

.table-wrap {
  position: relative;
  overflow: auto;
}

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

th,
td {
  padding: 15px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--navy);
  background: #fbfcff;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

td strong {
  display: block;
  color: var(--ink);
  font-size: 0.94rem;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--navy);
  background: var(--soft-blue);
  font-size: 0.75rem;
  font-weight: 900;
}

.muted-cell {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.status.active,
.status.approved {
  color: #0a6734;
  background: #e7f7ed;
}

.status.pending {
  color: #8b5c00;
  background: #fff4d5;
}

.status.inactive {
  color: #8d1f25;
  background: #fde9eb;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  min-width: 36px;
  height: 36px;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--line);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px;
  color: var(--muted);
}

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

.agenda-list {
  display: grid;
  gap: 10px;
  padding: 0 24px 24px;
}

.agenda-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.agenda-date {
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 900;
}

.agenda-item strong {
  display: block;
  margin-bottom: 3px;
  color: var(--navy);
}

.agenda-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.tool-grid button,
.file-button {
  min-height: 54px;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--line);
}

.file-button input {
  display: none;
}

.import-options {
  display: flex;
  gap: 14px;
  padding: 16px 24px 24px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.record-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: calc(100svh - 28px);
  padding: 0;
  border: 0;
  box-shadow: var(--shadow);
}

.record-dialog::backdrop {
  background: rgba(4, 25, 70, 0.68);
}

.record-form {
  background: var(--white);
}

.record-form header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-height: calc(100svh - 230px);
  overflow: auto;
  padding: 24px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  outline-color: var(--blue);
}

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

.attachment-field {
  display: grid;
  gap: 10px;
}

.quotes-module {
  display: grid;
  gap: 12px;
}

.quotes-table {
  overflow: auto;
  border: 1px solid var(--line);
  background: #fbfcff;
}

.quotes-head,
.quote-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(130px, 0.8fr) minmax(150px, 0.9fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 720px;
}

.quotes-head {
  padding: 10px 12px;
  color: var(--navy);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quote-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.quote-row:last-child {
  border-bottom: 0;
}

.quote-row input,
.quote-row select {
  min-height: 40px;
  padding: 8px 10px;
}

.quote-row button,
.add-quote {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.78rem;
  font-weight: 900;
}

.quote-row button {
  color: #a51018;
  background: #fde9eb;
  border: 1px solid #f5c8cc;
}

.add-quote {
  justify-self: start;
  color: var(--white);
  background: var(--navy);
  border: 1px solid var(--navy);
}

.attachment-drop {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 16px;
  background: var(--paper);
  border: 1px dashed #b9c8dc;
}

.attachment-drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.attachment-drop span {
  color: var(--navy);
  font-weight: 900;
}

.attachment-drop small {
  color: var(--muted);
  line-height: 1.4;
}

.attachment-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attachment-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: #fbfcff;
  border: 1px solid var(--line);
}

.attachment-list a {
  min-width: 0;
  overflow: hidden;
  color: var(--navy);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-list span,
.attachment-empty {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.attachment-list button {
  min-height: 32px;
  padding: 0 10px;
  color: #a51018;
  background: #fde9eb;
  border: 1px solid #f5c8cc;
  font-size: 0.78rem;
  font-weight: 900;
}

.record-form footer {
  justify-content: end;
  padding: 18px 24px 24px;
  border-top: 1px solid var(--line);
}

.record-form footer span {
  flex: 1;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 44px));
  padding: 14px 16px;
  color: var(--white);
  background: var(--navy-dark);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .side-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .sidebar-note {
    display: none;
  }

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

@media (max-width: 760px) {
  .workspace {
    padding: 18px 12px 28px;
  }

  .topbar,
  .panel-header,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .segmented,
  .search,
  .toolbar select {
    width: 100%;
  }

  .metrics,
  .grid-two,
  .tool-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .agenda-item {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 16px;
  }

  .side-nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .record-form footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .record-form footer span {
    display: none;
  }

  .attachment-list li {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .quotes-head,
  .quote-row {
    min-width: 640px;
  }
}
