:root {
  --green: #7bbf3a;
  --green-dark: #457b22;
  --mint: #edf8e8;
  --blue: #0878bf;
  --blue-dark: #075a91;
  --orange: #f28c1b;
  --ink: #12395b;
  --muted: #667c90;
  --line: #d6e7f2;
  --bg: #f4f9fc;
  --white: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.hero {
  min-height: 320px;
  color: var(--white);
  background:
    linear-gradient(120deg, rgba(7, 90, 145, .98), rgba(8, 120, 191, .92)),
    radial-gradient(circle at top right, rgba(242, 140, 27, .78), transparent 34%),
    radial-gradient(circle at bottom left, rgba(123, 191, 58, .48), transparent 28%);
  padding: 22px clamp(18px, 4vw, 56px) 54px;
}

.topbar,
.brand,
.stats,
.tabs,
.panel-heading {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
}

.brand {
  gap: 12px;
}

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

.brand span:last-child {
  display: block;
  opacity: .82;
  font-size: 14px;
}

.stats {
  gap: 10px;
  flex-wrap: wrap;
}

.stats span {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}

.hero-content {
  max-width: 820px;
  margin-top: 58px;
}

.eyebrow {
  color: #ffe2b8;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 13px;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1;
}

.hero-content p:last-child {
  max-width: 620px;
  color: rgba(255, 255, 255, .88);
  font-size: 18px;
}

.shell {
  width: min(1280px, calc(100% - 32px));
  margin: -36px auto 48px;
}

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.message,
.notice {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff6e8;
  border: 1px solid #ffd69e;
}

.message.success {
  background: var(--mint);
  border-color: #9fe4d4;
}

.message.error {
  background: #ffecec;
  border-color: #ffb8b8;
}

.mail-bubble {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 20;
  width: min(420px, calc(100% - 44px));
  padding: 18px;
  border: 2px solid var(--orange);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 48px rgba(23, 50, 77, .22);
}

.mail-bubble strong {
  display: block;
  color: var(--blue-dark);
  font-size: 20px;
  margin-bottom: 6px;
}

.mail-bubble p {
  color: var(--ink);
  margin-bottom: 14px;
}

.mail-bubble a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--blue);
  color: var(--white);
  font-weight: 900;
  text-decoration: none;
}

.tabs {
  width: fit-content;
  padding: 6px;
  gap: 4px;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 12px 32px rgba(23, 50, 77, .12);
  margin-bottom: 18px;
}

.tabs a,
.tab-disabled {
  padding: 12px 20px;
  border-radius: 6px;
  color: var(--blue-dark);
  text-decoration: none;
  font-weight: 800;
}

.tab-disabled {
  color: #9aabba;
  background: #eef3f6;
  cursor: not-allowed;
  opacity: .72;
}

.tabs a.active {
  color: var(--white);
  background: var(--blue);
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 28px);
  margin-bottom: 18px;
  box-shadow: 0 14px 36px rgba(23, 50, 77, .08);
}

.panel-heading {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-heading p {
  color: var(--muted);
  margin-bottom: 0;
}

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

.form-grid.wide {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.login-panel {
  max-width: 620px;
}

.login-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.file-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.files-hero {
  background:
    linear-gradient(135deg, rgba(8, 120, 191, .13), rgba(123, 191, 58, .10)),
    var(--white);
  border-color: #b8dff4;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 6px 0 0;
}

.breadcrumb a {
  color: var(--blue-dark);
  font-weight: 900;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf5fc;
}

.breadcrumb-separator {
  color: var(--orange);
  font-weight: 900;
}

.folder-current {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--orange);
  color: #17324d;
  font-weight: 900;
}

.folder-location {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 18px 0;
  padding: 16px 18px;
  border: 2px solid #b8dff4;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(234, 245, 252, .92));
}

.folder-location strong {
  display: block;
  margin-top: 4px;
  color: var(--blue-dark);
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.folder-location-counts {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--blue-dark);
  color: var(--white);
  font-weight: 900;
  white-space: nowrap;
}

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

.file-toolbar.single-tool {
  grid-template-columns: minmax(0, 1fr);
}

.file-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid #c4dfef;
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 8px 18px rgba(23, 50, 77, .06);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.folder-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.file-card {
  display: grid;
  gap: 14px;
  min-height: 178px;
  padding: 18px;
  border: 2px solid #b7d9ef;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #f2faff, #ffffff 68%);
  box-shadow: 0 12px 28px rgba(23, 50, 77, .08);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.file-card:hover {
  border-color: var(--blue);
  box-shadow: 0 14px 28px rgba(8, 120, 191, .16);
  transform: translateY(-1px);
}

.folder-card {
  min-height: 200px;
  border-color: #f3b45c;
  background:
    linear-gradient(135deg, #fff4df, #ffffff 64%);
  box-shadow: inset 0 8px 0 var(--orange), 0 14px 30px rgba(242, 140, 27, .12);
}

.folder-card.folder-tone-1 {
  border-color: #f3b45c;
  background:
    linear-gradient(135deg, #fff2d7, #ffffff 64%);
  box-shadow: inset 0 8px 0 var(--orange), 0 14px 30px rgba(242, 140, 27, .13);
}

.folder-card.folder-tone-2 {
  border-color: #8bc7ee;
  background:
    linear-gradient(135deg, #eaf7ff, #ffffff 64%);
  box-shadow: inset 0 8px 0 var(--blue), 0 14px 30px rgba(8, 120, 191, .13);
}

.folder-card.folder-tone-3 {
  border-color: #a9d77a;
  background:
    linear-gradient(135deg, #f0fae8, #ffffff 64%);
  box-shadow: inset 0 8px 0 var(--green), 0 14px 30px rgba(123, 191, 58, .13);
}

.folder-card.folder-tone-4 {
  border-color: #f2ce73;
  background:
    linear-gradient(135deg, #fff8dd, #ffffff 64%);
  box-shadow: inset 0 8px 0 #f0c64d, 0 14px 30px rgba(240, 198, 77, .13);
}

.folder-card.folder-tone-0 {
  border-color: #86d6cb;
  background:
    linear-gradient(135deg, #e8fbf8, #ffffff 64%);
  box-shadow: inset 0 8px 0 #22a88f, 0 14px 30px rgba(34, 168, 143, .13);
}

.file-card-main {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 58px;
  border-radius: 8px;
  background: var(--orange);
  color: #1c2b20;
  font-weight: 900;
  letter-spacing: .06em;
  font-size: 13px;
}

.folder-icon {
  position: relative;
  background: var(--orange);
  color: #17324d;
  box-shadow: 0 8px 18px rgba(242, 140, 27, .24);
}

.folder-icon::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 8px;
  width: 32px;
  height: 12px;
  border-radius: 6px 6px 0 0;
  background: inherit;
}

.file-icon-document {
  position: relative;
  background: #22a7c7;
  color: var(--white);
  box-shadow: 0 8px 18px rgba(34, 167, 199, .24);
}

.file-icon-document::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-top: 16px solid rgba(255, 255, 255, .85);
  border-left: 16px solid transparent;
  border-radius: 0 8px 0 0;
}

.file-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.file-title {
  display: block;
  min-width: 0;
  color: var(--blue-dark);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.folder-content-line {
  display: block;
  margin-top: 8px;
  color: #38546b;
  font-size: 14px;
  font-weight: 800;
}

.file-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.file-meta span:not(.badge) {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef6f7;
}

.file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
}

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

.button-link.subtle {
  min-height: 34px;
  padding: 8px 12px;
  background: #eaf5fc;
  color: var(--blue-dark);
}

.file-empty {
  grid-column: 1 / -1;
}

.import-export {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--blue);
  color: var(--white);
  font-weight: 900;
  text-decoration: none;
}

.helper-text {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-intro {
  background:
    linear-gradient(135deg, rgba(8, 120, 191, .08), rgba(242, 140, 27, .08)),
    var(--white);
}

.export-menu {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.export-menu details {
  position: relative;
}

.export-menu summary {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--blue-dark);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-options {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
  max-height: 430px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 44px rgba(23, 50, 77, .18);
}

.export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.export-check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.export-check input {
  width: 18px;
  min-height: 18px;
}

.pdf-hidden {
  display: none !important;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
}

.metric-card strong {
  display: block;
  color: var(--blue-dark);
  font-size: 30px;
  line-height: 1;
}

.metric-card p {
  margin: 8px 0 0;
  color: var(--ink);
  font-weight: 900;
}

.metric-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.chart-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 14px 36px rgba(23, 50, 77, .08);
}

.chart-card h3 {
  margin: 0 0 14px;
  color: var(--blue-dark);
}

.chart-bars {
  display: grid;
  gap: 11px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(140px, 2fr) 42px;
  gap: 10px;
  align-items: center;
}

.chart-label {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.chart-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7f1f7;
}

.chart-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--orange));
}

.chart-row strong {
  color: var(--blue-dark);
  text-align: right;
}

.chart-empty {
  padding: 18px;
}

.mission-wizard {
  display: grid;
  gap: 18px;
}

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

.wizard-dot {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.wizard-dot.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.wizard-dot.done {
  background: var(--mint);
  color: var(--blue-dark);
}

.mission-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfefd;
}

.mission-step[hidden] {
  display: none;
}

.step-heading {
  margin-bottom: 16px;
}

.step-heading h3 {
  margin: 0 0 6px;
  color: var(--blue-dark);
}

.step-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfefd;
  font: inherit;
}

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

.check {
  align-content: center;
  grid-template-columns: auto 1fr;
  color: var(--ink);
}

.check input {
  width: 18px;
  min-height: 18px;
}

.span-2 {
  grid-column: span 2;
}

button {
  align-self: end;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--orange);
  color: #1c2b20;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  filter: brightness(.97);
}

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

button.small {
  min-height: 34px;
  padding: 8px 12px;
  background: var(--blue);
  color: var(--white);
}

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

button.secondary {
  background: var(--mint);
  color: var(--blue-dark);
}

.file-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.file-link:hover {
  text-decoration: underline;
}

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

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--blue-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #f0faf7;
}

.mission-row-todo td {
  background: #fff4df;
  border-bottom-color: #f3d29a;
}

.mission-row-todo td:first-child {
  border-left: 5px solid var(--orange);
}

.mission-row-done td {
  background: var(--white);
  border-bottom-color: var(--line);
}

.mission-row-done td:first-child {
  border-left: 5px solid transparent;
}

.mission-row-stale td {
  background: #ffe9e9;
  border-bottom-color: #f1bbbb;
}

.mission-row-stale td:first-child {
  border-left: 5px solid #dc4c4c;
}

.mission-table {
  table-layout: fixed;
  min-width: 1080px;
}

.mission-table th:nth-child(1),
.mission-table td:nth-child(1) {
  width: 112px;
}

.mission-table th:nth-child(2),
.mission-table td:nth-child(2) {
  width: 86px;
}

.mission-table th:nth-child(3),
.mission-table td:nth-child(3) {
  width: 104px;
}

.mission-table th:nth-child(4),
.mission-table td:nth-child(4) {
  width: 150px;
}

.mission-table th:nth-child(5),
.mission-table td:nth-child(5),
.mission-table th:nth-child(6),
.mission-table td:nth-child(6),
.mission-table th:nth-child(7),
.mission-table td:nth-child(7) {
  width: 120px;
}

.mission-table .long-cell {
  width: 190px;
  max-width: 190px;
}

.cell-details summary {
  cursor: pointer;
  color: var(--blue-dark);
  font-weight: 700;
}

.cell-details div {
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge.ok {
  color: var(--green-dark);
  background: var(--mint);
}

.badge.wait {
  color: #8b5300;
  background: #fff0d8;
}

.badge.danger {
  display: flex;
  width: fit-content;
  margin-top: 6px;
  color: #8c1f1f;
  background: #ffd6d6;
}

.mission-alert {
  border-left: 6px solid #dc4c4c;
  background: #fff6f6;
}

.mission-alert ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.mission-alert li {
  padding: 8px 0;
}

.mission-alert li span {
  margin: 0 10px;
}

.mission-alert li em {
  color: #8c1f1f;
  font-style: normal;
  font-weight: 800;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 32px;
}

@media (max-width: 980px) {
  .form-grid,
  .form-grid.wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 640px) {
  .topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .span-2 {
    grid-column: span 1;
  }

  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .import-export,
  .file-form,
  .login-form,
  .folder-location,
  .file-toolbar,
  .file-tool {
    grid-template-columns: 1fr;
  }

  .folder-location-counts {
    justify-self: start;
    white-space: normal;
  }

  .metric-grid,
  .chart-grid,
  .chart-row {
    grid-template-columns: 1fr;
  }

  .chart-row strong {
    text-align: left;
  }
}

@media print {
  body {
    background: var(--white);
  }

  .hero,
  .tabs,
  .dashboard-intro button,
  .export-menu {
    display: none;
  }

  .shell {
    width: 100%;
    margin: 0;
  }

  .panel,
  .chart-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
