:root {
  --navy-950: #06152c;
  --navy-900: #071b38;
  --navy-800: #0a2853;
  --blue-600: #0b5dca;
  --blue-500: #2475d8;
  --blue-100: #eaf2ff;
  --surface: #f2f5fa;
  --card: #ffffff;
  --text: #14213a;
  --muted: #68758a;
  --border: #dce3ee;
  --danger: #c93845;
  --shadow: 0 18px 50px rgba(22, 52, 94, 0.13);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--surface); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--surface);
  font-family: Aptos, "Segoe UI", Inter, Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(52, 130, 229, 0.28);
  outline-offset: 2px;
}

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

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
  background:
    radial-gradient(circle at 92% 0%, rgba(80, 146, 235, 0.1), transparent 30rem),
    var(--surface);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  padding: 30px 22px 20px;
  color: #fff;
  background:
    radial-gradient(circle at 0 16%, rgba(33, 118, 237, 0.32), transparent 16rem),
    linear-gradient(165deg, #0a2349 0%, #071a35 58%, #06152c 100%);
}

.sidebar::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: linear-gradient(180deg, #62a9ff, #1e68cc 42%, transparent 82%);
}

.brand,
.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand { padding: 0 8px 38px; }

.brand-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(151, 198, 255, 0.42);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(77, 151, 252, 0.42), rgba(20, 73, 150, 0.25));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: 20px;
  font-weight: 800;
}

.brand strong,
.auth-brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: .14em;
}

.brand div > span,
.auth-brand div > span {
  display: block;
  margin-top: 2px;
  color: #a9c2e5;
  font-size: 13px;
}

.nav-tabs { display: grid; gap: 7px; }

.nav-tab {
  display: flex;
  width: 100%;
  min-height: 47px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #acc3df;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}

.nav-tab:hover { color: #fff; background: rgba(255, 255, 255, .06); }

.nav-tab.is-active {
  color: #fff;
  border-color: rgba(118, 176, 255, .22);
  background: linear-gradient(100deg, rgba(43, 124, 231, .3), rgba(30, 84, 159, .12));
  box-shadow: inset 3px 0 #5ca4ff;
}

.nav-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  color: #c7dcf7;
  border-radius: 7px;
  background: rgba(255, 255, 255, .07);
  font-size: 11px;
}

.nav-tab b {
  display: grid;
  min-width: 24px;
  height: 24px;
  margin-left: auto;
  padding: 0 7px;
  place-items: center;
  color: #c6daf3;
  border-radius: 20px;
  background: rgba(255, 255, 255, .08);
  font-size: 12px;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(135, 179, 235, .16);
  border-radius: 13px;
  background: rgba(255, 255, 255, .045);
}

.shield {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  place-items: center;
  color: #8fc1ff;
  border: 1px solid rgba(126, 184, 255, .28);
  border-radius: 8px;
  font-size: 12px;
}

.privacy-note strong,
.privacy-note div > span { display: block; }
.privacy-note strong { margin-bottom: 5px; font-size: 13px; }
.privacy-note div > span { color: #9eb5d3; font-size: 12px; line-height: 1.55; }

.user-block {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 16px;
  padding: 15px 8px 8px;
  border-top: 1px solid rgba(255, 255, 255, .09);
}

.user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: #1763c3;
  font-size: 12px;
  font-weight: 750;
}

.user-block strong,
.user-block div > span { display: block; }
.user-block strong { font-size: 13px; }
.user-block div > span { margin-top: 2px; color: #91a8c5; font-size: 12px; }

.logout-form { margin: 2px 8px 0; }
.logout-form button {
  width: 100%;
  padding: 8px;
  color: #91a8c5;
  border: 0;
  background: transparent;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.logout-form button:hover { color: #fff; }

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

.workspace-header {
  display: flex;
  max-width: 1440px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin: 0 auto 28px;
}

.eyebrow,
.section-heading > div > span {
  color: #2570cb;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.workspace-header h1 {
  margin: 6px 0 5px;
  color: #10213b;
  font-size: clamp(32px, 3.5vw, 46px);
  letter-spacing: -.035em;
  line-height: 1.08;
}

.workspace-header p { max-width: 620px; margin: 0; color: #637086; line-height: 1.55; }

.header-actions { display: flex; flex: 0 0 auto; gap: 10px; padding-top: 8px; }

.primary-button,
.outline-button,
.danger-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: .17s ease;
}

.primary-button { color: #fff; border: 1px solid #0b5dca; background: #0b5dca; box-shadow: 0 7px 18px rgba(11, 93, 202, .18); }
.primary-button:hover { border-color: #094fae; background: #094fae; transform: translateY(-1px); }
.primary-button:disabled { opacity: .62; cursor: wait; transform: none; }
.outline-button { color: #31435c; border: 1px solid #d3dce9; background: #fff; }
.outline-button:hover, .outline-button.is-active { color: #0a55b0; border-color: #aac8ee; background: #f1f7ff; }
.danger-button { color: #fff; border: 1px solid #bd3340; background: #c93845; }
.danger-button:hover { background: #b82f3b; }

.overview {
  display: flex;
  max-width: 1440px;
  min-height: 132px;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin: 0 auto 22px;
  padding: 24px 30px;
  overflow: hidden;
  color: #fff;
  border: 1px solid rgba(82, 150, 237, .4);
  border-radius: 18px;
  background:
    radial-gradient(circle at 78% 0%, rgba(66, 149, 255, .38), transparent 22rem),
    linear-gradient(115deg, #0a2853, #0a3d7d 68%, #0756a7);
  box-shadow: var(--shadow);
}

.overview-copy { display: flex; min-width: 0; align-items: center; gap: 16px; }
.overview-symbol {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 15px;
  background: rgba(255, 255, 255, .09);
  font-size: 20px;
  font-weight: 800;
}
.overview-copy div > span,
.overview-copy strong { display: block; }
.overview-copy div > span { margin-bottom: 6px; color: #a9cfff; font-size: 13px; font-weight: 650; }
.overview-copy strong { max-width: 470px; font-size: clamp(18px, 2vw, 24px); line-height: 1.25; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(86px, 1fr)); flex: 0 0 auto; }
.metrics div { min-width: 105px; padding: 4px 22px; border-left: 1px solid rgba(255, 255, 255, .15); }
.metrics strong, .metrics span { display: block; }
.metrics strong { font-size: 29px; line-height: 1; }
.metrics span { margin-top: 8px; color: #b9d1ef; font-size: 12px; white-space: nowrap; }

.toolbar {
  display: flex;
  max-width: 1440px;
  align-items: center;
  gap: 12px;
  margin: 0 auto 28px;
}

.search-field { position: relative; flex: 1; }
.search-field > span { position: absolute; top: 50%; left: 14px; color: #738197; font-size: 24px; line-height: 1; transform: translateY(-54%); }
.search-field input,
.toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.auth-form input {
  width: 100%;
  color: #1c2c44;
  border: 1px solid #d4deea;
  border-radius: 9px;
  outline: none;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-field input:focus,
.toolbar select:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.auth-form input:focus { border-color: #5e9ce8; box-shadow: 0 0 0 3px rgba(49, 125, 222, .13); }
.search-field input { height: 44px; padding: 0 14px 0 43px; box-shadow: 0 4px 18px rgba(26, 51, 87, .04); }
.toolbar select { width: 205px; height: 44px; padding: 0 36px 0 13px; }

.reports-section { max-width: 1440px; margin: 0 auto; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 4px 0 0; color: #17263c; font-size: 23px; letter-spacing: -.02em; }
.section-heading p { margin: 0; color: #748095; font-size: 13px; }

.report-grid,
.loading-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }

.report-card,
.loading-grid > div {
  min-height: 276px;
  padding: 22px;
  border: 1px solid #dce4ef;
  border-radius: 16px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 8px 30px rgba(32, 57, 91, .055);
}

.loading-grid > div { background: linear-gradient(100deg, #f4f6fa 20%, #fff 40%, #f4f6fa 60%); background-size: 200% 100%; animation: loading 1.3s infinite; }
@keyframes loading { to { background-position-x: -200%; } }

.report-card { position: relative; display: flex; overflow: hidden; flex-direction: column; transition: .18s ease; }
.report-card::before { position: absolute; inset: 0 28px auto; height: 3px; content: ""; border-radius: 0 0 5px 5px; background: linear-gradient(90deg, #1165d2, #58a3fc); }
.report-card:hover { border-color: #b8ceed; box-shadow: 0 18px 45px rgba(23, 62, 116, .12); transform: translateY(-3px); }

.card-top { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; }
.file-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #1465c7;
  border: 1px solid #d7e6fa;
  border-radius: 13px;
  background: linear-gradient(145deg, #f1f7ff, #e7f1ff);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.open-arrow { display: grid; width: 32px; height: 32px; place-items: center; color: #7b899c; border-radius: 50%; background: #f2f5f9; transition: .18s; }
.report-card:hover .open-arrow { color: #fff; background: #1765c7; }

.management-actions { display: flex; gap: 5px; }
.management-actions button { padding: 7px 8px; color: #426087; border: 0; border-radius: 7px; background: transparent; font-size: 12px; font-weight: 650; cursor: pointer; }
.management-actions button:hover { color: #0b5dca; background: #edf5ff; }
.management-actions .danger-link { color: #b83a46; }
.management-actions .danger-link:hover { color: #a12431; background: #fff0f1; }

.card-main { display: flex; width: 100%; flex: 1; flex-direction: column; align-items: flex-start; padding: 20px 0 15px; color: inherit; border: 0; background: transparent; text-align: left; cursor: pointer; }
.customer-name { margin-bottom: 7px; color: #2b70c4; font-size: 12px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.card-main > strong { display: -webkit-box; overflow: hidden; color: #17273f; font-size: 19px; line-height: 1.28; letter-spacing: -.015em; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.description { display: -webkit-box; margin-top: 9px; overflow: hidden; color: #6a7689; font-size: 13px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }

.card-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-top: 15px; border-top: 1px solid #edf0f5; }
.card-footer > div { display: flex; min-width: 0; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; max-width: 160px; padding: 4px 8px; overflow: hidden; color: #245a9d; border-radius: 20px; background: #eaf2ff; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.badge-outline { color: #68758a; border: 1px solid #dce3ed; background: #fff; }
.card-footer small { flex: 0 0 auto; color: #8792a3; font-size: 11px; white-space: nowrap; }

.empty-state,
.error-state { min-height: 310px; padding: 40px; color: #68758a; border: 1px dashed #cbd6e5; border-radius: 16px; background: rgba(255, 255, 255, .58); text-align: center; }
.empty-state { display: grid; place-items: center; align-content: center; }
.empty-state > span { display: grid; width: 46px; height: 46px; margin-bottom: 14px; place-items: center; color: #3e7ecb; border-radius: 13px; background: #e8f2ff; font-weight: 800; }
.empty-state h3, .error-state strong { margin: 0; color: #23334b; font-size: 18px; }
.empty-state p, .error-state p { margin: 8px 0 0; font-size: 14px; }
.error-state { grid-column: 1 / -1; }
.error-state p { margin-bottom: 18px; }

.modal {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  color: var(--text);
  border: 1px solid #d8e0eb;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(8, 28, 56, .28);
}
.modal::backdrop { background: rgba(5, 17, 35, .62); backdrop-filter: blur(4px); }
.report-modal form { padding: 24px; }
.modal-heading,
.viewer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-heading h2,
.viewer-header h2,
.confirm-copy h2 { margin: 0; color: #17263d; font-size: 20px; }
.modal-heading p,
.viewer-header p,
.confirm-copy p { margin: 6px 0 0; color: #6e7a8d; font-size: 14px; line-height: 1.5; }
.icon-button { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; color: #6d798b; border: 0; border-radius: 9px; background: #f0f3f7; font-size: 24px; cursor: pointer; }
.icon-button:hover { color: #1f314b; background: #e7ecf3; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 24px 0; }
.form-grid label { display: grid; gap: 7px; color: #24334a; font-size: 13px; font-weight: 650; }
.form-grid input, .form-grid select { height: 42px; padding: 0 12px; }
.form-grid textarea { min-height: 96px; padding: 11px 12px; resize: vertical; }
.form-grid input[type="file"] { height: auto; padding: 10px; }
.form-grid small, .form-grid em { color: #7d899a; font-size: 12px; font-style: normal; font-weight: 400; }
.full-field { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; }

.viewer-modal { width: calc(100vw - 28px); height: calc(100vh - 28px); height: calc(100dvh - 28px); overflow: hidden; }
.viewer-modal[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.viewer-header { align-items: center; padding: 15px 18px; border-bottom: 1px solid #dde4ed; }
.viewer-header > div:first-child { min-width: 0; }
.viewer-header h2, .viewer-header p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-header > div:last-child { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.viewer-modal iframe { width: 100%; height: 100%; min-height: 0; border: 0; background: #fff; }

.confirm-modal { width: min(480px, calc(100vw - 32px)); padding: 24px; }
.confirm-copy { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.confirm-copy > span { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; color: #a52733; border-radius: 12px; background: #ffedef; font-weight: 800; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(390px, calc(100vw - 32px)); padding: 13px 16px; color: #fff; border-radius: 10px; background: #173e70; box-shadow: 0 18px 50px rgba(7, 31, 62, .28); font-size: 14px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #a92f3b; }

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 14% 15%, rgba(43, 119, 218, .31), transparent 25rem),
    radial-gradient(circle at 88% 84%, rgba(25, 93, 182, .2), transparent 25rem),
    linear-gradient(145deg, #06152c, #0a2b57 65%, #0b3971);
}
.auth-panel { width: min(480px, 100%); padding: 34px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 22px; background: rgba(255, 255, 255, .98); box-shadow: 0 35px 100px rgba(0, 0, 0, .3); }
.auth-brand { padding-bottom: 28px; border-bottom: 1px solid #e8edf4; }
.auth-brand strong { color: #14263f; }
.auth-brand div > span { color: #718095; }
.auth-copy { margin: 28px 0 22px; }
.auth-copy h1 { margin: 7px 0 8px; color: #13243d; font-size: 28px; letter-spacing: -.03em; }
.auth-copy p { margin: 0; color: #68758a; font-size: 14px; line-height: 1.6; }
.auth-form { display: grid; gap: 9px; }
.auth-form label { margin-top: 5px; color: #2a3a50; font-size: 13px; font-weight: 650; }
.auth-form input { height: 44px; padding: 0 12px; }
.auth-form .primary-button { margin-top: 12px; }
.auth-note { margin: 16px 0 0; color: #7e8999; font-size: 12px; text-align: center; }
.form-alert { margin-bottom: 17px; padding: 11px 13px; color: #9f2935; border: 1px solid #f1c8cc; border-radius: 9px; background: #fff0f1; font-size: 13px; line-height: 1.5; }

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; display: grid; height: auto; grid-template-columns: auto 1fr auto; align-items: center; gap: 26px; padding: 17px 24px; }
  .brand { padding: 0; }
  .nav-tabs { display: flex; justify-self: center; }
  .nav-tab { min-width: 142px; }
  .privacy-note, .logout-form { display: none; }
  .user-block { margin: 0; padding: 0; border: 0; }
  .workspace { padding: 32px 30px 54px; }
  .overview { gap: 20px; }
  .metrics div { min-width: 90px; padding: 4px 16px; }
}

@media (max-width: 760px) {
  .sidebar { display: flex; flex-flow: row wrap; gap: 14px; padding: 14px 16px; }
  .brand { flex: 1; }
  .brand-symbol { width: 39px; height: 39px; flex-basis: 39px; }
  .brand strong { font-size: 16px; }
  .user-block div { display: none; }
  .nav-tabs { order: 3; width: 100%; }
  .nav-tab { min-width: 0; }
  .workspace { padding: 25px 16px 46px; }
  .workspace-header { flex-direction: column; margin-bottom: 22px; }
  .workspace-header h1 { font-size: 34px; }
  .header-actions { width: 100%; padding-top: 0; }
  .header-actions > button { flex: 1; }
  .overview { align-items: stretch; flex-direction: column; padding: 22px; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .metrics div { min-width: 0; padding: 4px 12px; }
  .metrics div:first-child { border-left: 0; }
  .metrics strong { font-size: 24px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar select { width: 100%; }
  .report-grid, .loading-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .viewer-modal { width: 100vw; height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
  .viewer-header .outline-button { width: 40px; overflow: hidden; padding: 0; font-size: 0; }
  .viewer-header .outline-button::before { content: "↗"; font-size: 17px; }
}

@media (max-width: 460px) {
  .auth-page { padding: 14px; }
  .auth-panel { padding: 25px 21px; }
  .auth-copy h1 { font-size: 25px; }
  .header-actions { flex-direction: column; }
  .overview-copy { align-items: flex-start; }
  .overview-symbol { width: 44px; height: 44px; flex-basis: 44px; }
  .metrics div { padding: 4px 7px; }
  .metrics span { font-size: 10px; }
  .card-footer { align-items: flex-start; flex-direction: column; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
}

