:root {
  --navy: #071525;
  --navy2: #0d2a49;
  --blue: #1f6feb;
  --cyan: #19a8c7;
  --ink: #132236;
  --muted: #6f7e92;
  --line: #e7edf5;
  --bg: #f4f7fb;
  --green: #1c9b63;
  --red: #d64545;
  --gold: #c99632;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
select,
textarea {
  font: inherit;
}
.hidden {
  display: none !important;
}
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: linear-gradient(180deg, var(--navy), #0b213b);
  color: white;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: grid;
  place-items: center;
  font-weight: 900;
}
.brand small {
  display: block;
  color: #82b9ff;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
}
.nav {
  display: grid;
  gap: 5px;
}
.nav button {
  border: 0;
  background: transparent;
  color: #bdc9d9;
  padding: 11px 12px;
  border-radius: 11px;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
}
.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}
.nav button.active {
  background: linear-gradient(135deg, #1f6feb, #1559c1);
}
.nav i {
  width: 24px;
}
.sidebar-bottom {
  margin-top: auto;
  color: #75869c;
  font-size: 12px;
  padding: 8px;
}
.main {
  min-width: 0;
}
.topbar {
  height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e8f0ff;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 900;
}
.content {
  padding: 28px;
  max-width: 1680px;
  margin: 0 auto;
}
.page {
  display: none;
}
.page.active {
  display: block;
}
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
  color: #8291a7;
}
.title {
  font-size: 30px;
  margin: 5px 0 20px;
}
.hero {
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  color: white;
  border-radius: 22px;
  padding: 24px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.hero h2 {
  margin: 4px 0 8px;
}
.hero p {
  color: #b9c8dc;
  margin: 0;
  max-width: 700px;
}
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
.btn.primary {
  background: var(--blue);
  color: white;
}
.btn.secondary {
  background: #edf3fb;
  color: #2c4c72;
}
.btn.danger {
  background: #fff0f0;
  color: #b83232;
}
.btn.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: #526278;
}
.grid {
  display: grid;
  gap: 18px;
}
.kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 22px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 8px 28px rgba(19, 34, 54, 0.05);
}
.kpi {
  padding: 18px;
  min-width: 0;
}
.kpi .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #7f8ca0;
  font-weight: 900;
}
.kpi .value {
  font-size: clamp(22px, 2vw, 32px);
  font-weight: 900;
  margin-top: 8px;
  word-break: break-word;
}
.section-grid {
  grid-template-columns: 2fr 1fr;
  margin-bottom: 22px;
}
.panel {
  padding: 20px;
}
.panel h3 {
  margin: 2px 0 16px;
}
.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 220px;
  border-bottom: 1px solid #dfe6ef;
  padding: 0 8px;
}
.bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 7px;
}
.bar {
  width: min(44px, 68%);
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #2c7cf1, #1b5dc2);
  min-height: 4px;
}
.bar-label {
  font-size: 11px;
  color: #76869b;
}
.list {
  display: grid;
  gap: 9px;
}
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px;
  border-radius: 12px;
  background: #f8fafc;
}
.rank {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
}
.table-card {
  overflow: hidden;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.toolbar input {
  padding: 9px 12px;
  border: 1px solid #d9e2ee;
  border-radius: 9px;
  min-width: 250px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  font-size: 13px;
}
th {
  background: #f8fafc;
  color: #67778d;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
tbody tr:hover {
  background: #fafcff;
}
.actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}
.pill.pending {
  background: #eaf2ff;
  color: #1f6feb;
}
.pill.overdue {
  background: #ffecec;
  color: #c93434;
}
.pill.done {
  background: #eaf8f0;
  color: #14814d;
}
.followup-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.follow-card {
  padding: 16px;
}
.follow-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.follow-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #eef4ff;
  color: var(--blue);
  display: grid;
  place-items: center;
}
.empty {
  padding: 34px;
  text-align: center;
  color: #8492a4;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 13, 24, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
}
.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  background: #fff;
  border-radius: 18px;
  width: min(720px, calc(100vw - 30px));
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}
.modal-lg {
  width: min(980px, calc(100vw - 30px));
}
.modal-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body {
  padding: 20px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.field {
  display: grid;
  gap: 6px;
}
.field.full {
  grid-column: 1/-1;
}
.field label {
  font-size: 12px;
  color: #607086;
  font-weight: 800;
}
.field input,
.field select,
.field textarea {
  padding: 10px 11px;
  border: 1px solid #d7e0ec;
  border-radius: 9px;
  background: #fff;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.quote-sheet {
  background: white;
  color: #122033;
  width: 210mm;
  min-height: 297mm;
  margin: auto;
  padding: 14mm 15mm;
}
.quote-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 3px solid #0d4b85;
  padding-bottom: 12px;
}
.quote-logo {
  display: flex;
  gap: 12px;
  align-items: center;
}
.quote-logo .mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #0d4b85;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}
.quote-meta {
  min-width: 220px;
  background: #f5f8fc;
  border: 1px solid #dae4f0;
  border-radius: 12px;
  padding: 12px;
}
.quote-client {
  margin: 18px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.quote-box {
  border: 1px solid #dfe7f2;
  border-radius: 12px;
  padding: 12px;
  background: #fbfcfe;
}
.quote-total {
  margin-left: auto;
  width: 280px;
  background: #0b213b;
  color: white;
  border-radius: 14px;
  padding: 16px;
  text-align: right;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #071525, #103b63);
}
.login-card {
  width: min(420px, calc(100vw - 30px));
  background: white;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
}
.login-card input {
  width: 100%;
  padding: 12px;
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  margin: 6px 0 14px;
}
.notice {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff5dd;
  color: #8a5d00;
  font-size: 13px;
  margin-bottom: 14px;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999;
  background: #10243c;
  color: white;
  padding: 12px 16px;
  border-radius: 11px;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.2);
}
@media (max-width: 1100px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .section-grid {
    grid-template-columns: 1fr;
  }
  .followup-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
  }
  .nav {
    grid-template-columns: repeat(2, 1fr);
  }
  .content {
    padding: 16px;
  }
  .kpis {
    grid-template-columns: 1fr;
  }
  .followup-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .topbar {
    padding: 0 16px;
  }
  .quote-sheet {
    width: 100%;
    min-height: auto;
    padding: 20px;
  }
  .quote-client {
    grid-template-columns: 1fr;
  }
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .toolbar input {
    min-width: 0;
    width: 100%;
  }
}
@page {
  size: A4 portrait;
  margin: 0;
}
@media print {
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  .app,
  .login,
  .modal-backdrop,
  .no-print {
    display: none !important;
  }
  #modal-root,
  .modal {
    display: block !important;
    position: static !important;
    transform: none !important;
    width: auto !important;
    max-height: none !important;
    overflow: visible !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .quote-sheet {
    position: static !important;
    margin: 0 !important;
    width: 210mm !important;
    min-height: 297mm !important;
    padding: 14mm 15mm !important;
    box-shadow: none !important;
  }
  .quote-sheet table {
    table-layout: fixed !important;
  }
  .quote-sheet th:first-child,
  .quote-sheet td:first-child {
    width: 49%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .quote-sheet th:not(:first-child),
  .quote-sheet td:not(:first-child) {
    white-space: nowrap;
  }
  .quote-sheet tr,
  .quote-box,
  .quote-total {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .quote-sheet thead {
    display: table-header-group;
  }
}
