:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --line: #d8e1ed;
  --ink: #19304e;
  --muted: #61758f;
  --accent: #214b7d;
  --accent-soft: #dfe9f5;
  --danger: #c93838;
  --danger-soft: #fdecec;
  --success: #156c4a;
  --success-soft: #e8f7ef;
  --shadow: 0 28px 60px -35px rgba(25, 48, 78, 0.35);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(33, 75, 125, 0.16), transparent 24rem),
    linear-gradient(180deg, #f4f7fb 0%, #eaf0f7 100%);
}

a {
  color: var(--accent);
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

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

.sidebar {
  background: #163557;
  color: #fff;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

.sidebar h1,
.auth-hero h1,
.hero h2,
.section-head h2,
.print-head h1 {
  margin: 0;
  line-height: 1.15;
}

.sidebar-copy,
.muted {
  color: var(--muted);
}

.sidebar-copy {
  color: rgba(255, 255, 255, 0.78);
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  border-radius: 16px;
  padding: 12px 14px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-user {
  padding: 18px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  display: grid;
  gap: 8px;
}

.content {
  width: 100%;
  min-width: 0;
  padding: clamp(18px, 2.4vw, 32px);
}

.content-auth {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-card {
  min-height: calc(100vh - 56px);
  width: 100%;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

.auth-hero,
.auth-panel,
.card,
.print-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.auth-hero {
  background: linear-gradient(160deg, #183557, #2a537f);
  color: #fff;
  padding: 42px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.auth-hero p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
  line-height: 1.6;
}

.auth-points {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}

.auth-point {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 6px;
}

.auth-point strong {
  font-size: 15px;
}

.auth-point span {
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.5;
  font-size: 14px;
}

.auth-panel {
  padding: 36px;
  display: grid;
  align-content: center;
  gap: 18px;
  min-width: 0;
}

.auth-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.auth-demo-box {
  min-width: 220px;
  padding: 14px 16px;
  border-radius: 20px;
  background: #f6f9fd;
  border: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

.auth-demo-box span {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.auth-demo-box strong {
  font-size: 14px;
  color: var(--ink);
}

.auth-demo-box small {
  color: var(--muted);
  font-size: 13px;
}

.auth-footer {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.login-shell {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-card {
  width: 100%;
  max-width: min(520px, 100%);
  padding: clamp(20px, 4vw, 42px);
  border-radius: clamp(22px, 4vw, 36px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.98) 100%);
  box-shadow: 0 36px 80px -38px rgba(25, 48, 78, 0.42);
  border: 1px solid rgba(216, 225, 237, 0.9);
}

.login-card h1 {
  margin: 10px 0 0;
  font-size: 42px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.login-copy {
  margin: 12px 0 0;
  font-size: 17px;
  line-height: 1.6;
}

.login-form {
  margin-top: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.login-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
  color: #6c89ab;
}

.form-stack,
.grid-form {
  display: grid;
  gap: 18px;
}

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

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

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

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

input:focus,
textarea:focus {
  outline: 2px solid rgba(33, 75, 125, 0.18);
  border-color: #8ea6c5;
  background: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button.small {
  padding: 10px 14px;
  font-size: 13px;
}

.button.full {
  width: 100%;
}

.hero,
.section-head,
.split-wrap,
.toolbar,
.button-group,
.badge-row,
.print-head,
.print-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0;
}

.card,
.print-card {
  padding: 24px;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 14px;
}

.metric-label {
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  background: #f8fbff;
  font-weight: 700;
}

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

.empty,
.empty-panel {
  color: var(--muted);
}

.empty-panel {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: #fbfdff;
}

.empty-panel p {
  margin-top: 0;
  line-height: 1.6;
}

.detail-card,
.form-card,
.creditor-card {
  margin-bottom: 20px;
}

.creditor-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 14px;
}

.note-box {
  margin-top: 18px;
  background: #f6f9fd;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  line-height: 1.6;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: #eef3f9;
}

.segmented a {
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--muted);
}

.segmented a.active {
  color: var(--ink);
  background: #fff;
}

.alert {
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: 18px;
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.error-text {
  color: var(--danger);
  font-weight: 500;
}

.print-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.print-summary {
  text-align: right;
}

.print-summary strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}

.print-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-bottom: 18px;
}

.print-table th,
.print-table td {
  font-size: 12px;
  padding: 10px 8px;
}

@media (max-width: 960px) {
  .auth-card,
  .cards,
  .grid-form,
  .meta-grid,
  .print-meta {
    grid-template-columns: 1fr;
  }

  .app-shell {
    display: block;
    min-height: auto;
  }

  .sidebar {
    padding: 20px 16px;
    border-radius: 0 0 24px 24px;
  }

  .nav,
  .sidebar-user,
  .button-group,
  .toolbar,
  .section-head,
  .split-wrap,
  .hero,
  .login-brand,
  .print-head,
  .print-actions {
    align-items: stretch;
  }

  .nav-link,
  .sidebar-user .button,
  .toolbar .button,
  .button-group .button,
  .button-group form,
  .button-group a {
    width: 100%;
  }

  .toolbar input {
    min-width: 0;
  }

  .actions-cell {
    flex-direction: column;
  }

  .actions-cell .button,
  .actions-cell form {
    width: 100%;
  }

  .content,
  .content-auth,
  .print-shell {
    padding: 16px;
  }

  .card,
  .print-card,
  .auth-panel,
  .auth-hero,
  .login-card {
    padding: 18px;
    border-radius: 22px;
  }

  table {
    min-width: 640px;
  }

  th,
  td {
    padding: 12px 10px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .content,
  .content-auth,
  .print-shell {
    padding: 12px;
  }

  .sidebar {
    gap: 20px;
  }

  .hero h2,
  .section-head h2,
  .auth-hero h1,
  .print-head h1,
  .login-card h1 {
    font-size: 28px;
  }

  .login-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .login-badge {
    width: auto;
  }

  .login-card {
    max-width: 100%;
  }

  .metric strong {
    font-size: 26px;
  }

  .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .segmented a {
    text-align: center;
  }

  .button,
  .button.small,
  .button.secondary,
  .button.primary,
  .button.danger {
    width: 100%;
  }

  .table-wrap {
    margin-inline: -4px;
  }

  table {
    min-width: 560px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .print-card {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }

  .print-table thead {
    display: table-header-group;
  }

  .print-table tr,
  .print-table td,
  .print-table th {
    page-break-inside: avoid;
  }
}
