:root {
  --bg: #eef3fb;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fffaf3;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: rgba(31, 36, 48, 0.09);
  --brand: #3c467d;
  --brand-strong: #2f3868;
  --accent: #7181c7;
  --danger: #b42318;
  --shadow: 0 20px 50px rgba(39, 54, 112, 0.14);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(113, 129, 199, 0.24), transparent 30%),
    radial-gradient(circle at top right, rgba(60, 70, 125, 0.18), transparent 34%),
    linear-gradient(180deg, #f9fbff 0%, #edf2fb 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0));
}

a {
  color: inherit;
}

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

#app {
  position: relative;
  min-height: 100vh;
}

.screen {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero {
  display: grid;
  gap: 24px;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: start;
}

.hero-card,
.login-card,
.panel,
.stat-card,
.summary-card,
.table-card,
.empty-card {
  background: var(--panel);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 36px;
  border-radius: 34px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(60, 70, 125, 0.11);
  color: var(--brand);
}

.hero h1,
.title {
  margin: 14px 0 10px;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 1;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.6rem);
}

.hero p,
.muted {
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(1120px, 100%);
  border-radius: 32px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-aside {
  padding: 42px;
  background:
    linear-gradient(180deg, rgba(60, 70, 125, 0.96), rgba(47, 56, 104, 0.94)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent);
  color: #f6f4ef;
}

.brand-lockup {
  display: flex;
  align-items: center;
}

.brand-lockup-login {
  margin-bottom: 22px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.brand-logo-login {
  max-width: 340px;
}

.login-aside h2 {
  margin: 20px 0 14px;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: clamp(2.2rem, 4vw, 3.3rem);
}

.login-main {
  padding: 42px;
  background: var(--panel-strong);
}

.login-panel {
  margin-top: 24px;
  padding: 20px;
  border-radius: 18px;
  background: rgba(113, 129, 199, 0.11);
  border: 1px solid rgba(113, 129, 199, 0.2);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.dashboard-header h1 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.header-actions,
.inline-actions,
.filters,
.toolbar,
.form-grid,
.stats-grid,
.layout-grid,
.summary-grid,
.admin-grid {
  display: grid;
  gap: 16px;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 22px;
}

.stat-card,
.summary-card,
.panel,
.table-card,
.empty-card {
  padding: 24px;
  border-radius: var(--radius-lg);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.stat-value {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
}

.stat-card-status {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 12px;
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
  max-width: 100%;
  width: auto;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(60, 70, 125, 0.12);
  background: rgba(248, 250, 255, 0.9);
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.status-dot-open {
  background: #7181c7;
  box-shadow: 0 0 0 6px rgba(113, 129, 199, 0.16);
}

.status-dot-closed {
  background: #3c467d;
  box-shadow: 0 0 0 6px rgba(60, 70, 125, 0.14);
}

.status-text {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
}

.status-caption {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.layout-grid {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.panel h2,
.table-card h2,
.summary-card h2 {
  margin: 0 0 18px;
  font-size: 1.2rem;
}

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

.field,
.field-full {
  display: grid;
  gap: 8px;
}

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

label {
  font-size: 0.92rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(31, 36, 48, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(60, 70, 125, 0.55);
  box-shadow: 0 0 0 4px rgba(60, 70, 125, 0.12);
  transform: translateY(-1px);
}

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

.btn,
.btn-secondary,
.btn-ghost,
.btn-danger {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.btn-danger:hover {
  transform: translateY(-1px);
}

.btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
  box-shadow: 0 12px 24px rgba(60, 70, 125, 0.22);
}

.btn-secondary {
  background: rgba(113, 129, 199, 0.14);
  color: var(--brand-strong);
}

.btn-ghost {
  background: rgba(31, 36, 48, 0.05);
  color: var(--ink);
}

.btn-danger {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.btn:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

.hint {
  font-size: 0.9rem;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.tag-open {
  background: rgba(113, 129, 199, 0.14);
  color: var(--brand);
}

.tag-closed {
  background: rgba(60, 70, 125, 0.12);
  color: var(--brand-strong);
}

.filters,
.toolbar,
.inline-actions,
.summary-grid,
.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.toolbar {
  margin-bottom: 16px;
}

.table-card {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tr:last-child td {
  border-bottom: 0;
}

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

.empty-card {
  text-align: center;
  color: var(--muted);
}

.summary-card p,
.panel p,
.table-card p {
  margin-top: 0;
}

.signature-pad-wrap {
  display: grid;
  gap: 12px;
}

.signature-pad-box,
.signature-preview-wrap {
  border: 1px solid rgba(60, 70, 125, 0.18);
  border-radius: 18px;
  padding: 14px 14px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 244, 252, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.signature-pad-box {
  position: relative;
  max-width: 560px;
  width: 100%;
  overflow: hidden;
}

.signature-pad-box::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 26px;
  border-top: 2px solid rgba(60, 70, 125, 0.22);
  pointer-events: none;
}

.signature-pad-note {
  margin-bottom: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(60, 70, 125, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.signature-pad {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(113, 129, 199, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 247, 253, 0.98));
  touch-action: none;
  cursor: crosshair;
}

.signature-preview {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
}

.notice,
.error {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 16px;
}

.notice {
  background: rgba(113, 129, 199, 0.12);
  color: var(--brand-strong);
}

.error {
  background: rgba(180, 35, 24, 0.11);
  color: var(--danger);
}

.summary-list,
.mini-list {
  display: grid;
  gap: 10px;
}

.summary-item,
.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.summary-item:last-child,
.mini-item:last-child {
  border-bottom: 0;
}

.footer-note {
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--muted);
}

.print-sheet {
  display: none;
}

.print-sheet img {
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1080px) {
  .login-card,
  .hero,
  .layout-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .screen,
  .login-main,
  .login-aside {
    padding: 20px;
  }

  .stats-grid,
  .form-grid,
  .filters,
  .toolbar,
  .summary-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .signature-pad-box {
    max-width: 100%;
  }

  .dashboard-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions,
  .row-actions {
    width: 100%;
  }

  .header-actions > button,
  .row-actions > button {
    flex: 1 1 auto;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }

  tbody tr:last-child {
    border-bottom: 0;
  }

  td {
    padding: 8px 0;
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  body {
    background: white;
    font-size: 10.5pt;
    color: #142033;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #app {
    min-height: auto;
  }

  body::before,
  .eyebrow,
  .header-actions,
  .panel,
  .row-actions,
  .toolbar,
  .filters,
  .footer-note,
  .notice,
  .error,
  .stats-grid {
    display: none !important;
  }

  .screen,
  .table-card,
  .summary-card,
  .stat-card {
    box-shadow: none;
    background: white;
    border: 1px solid #ddd;
  }

  .screen {
    max-width: none;
    padding: 0;
    display: block;
  }

  .screen-employee > * {
    display: none !important;
  }

  .screen-employee > .print-sheet {
    display: block !important;
    margin: 0;
  }

  .dashboard-header {
    margin-bottom: 12px;
  }

  .dashboard-header h1 {
    font-size: 28pt;
    margin-top: 0;
  }

  .muted {
    color: #555 !important;
  }

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

  .layout-grid,
  .summary-grid,
  .admin-grid {
    display: block !important;
    grid-template-columns: 1fr !important;
    gap: 0;
  }

  .summary-grid {
    margin-top: 10px !important;
  }

  .stat-card,
  .summary-card,
  .table-card {
    padding: 12px;
    border-radius: 0;
  }

  .table-card {
    margin-top: 0 !important;
    page-break-inside: auto;
    break-inside: auto;
    overflow: visible;
  }

  .summary-card {
    margin-top: 10mm;
    page-break-before: always;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .stat-value {
    font-size: 20pt;
  }

  .status-line {
    min-height: auto;
    padding: 8px 12px;
    border: 1px solid #bbb;
    background: white !important;
  }

  .status-caption {
    font-size: 9pt;
  }

  table {
    width: 100%;
    display: table;
    font-size: 9.5pt;
    table-layout: fixed;
  }

  thead {
    display: table-header-group;
  }

  tbody {
    display: table-row-group;
  }

  tr {
    display: table-row;
    page-break-inside: avoid;
  }

  th,
  td {
    display: table-cell;
    padding: 8px 6px;
    vertical-align: top;
    word-break: break-word;
  }

  td::before {
    content: none !important;
  }

  .signature-pad-wrap {
    display: none !important;
  }

  .signature-preview-wrap {
    max-width: 420px;
  }

  .print-sheet-page {
    display: block;
    color: #142033;
  }

  .print-brand {
    display: grid;
    grid-template-columns: 110px 1fr 180px;
    gap: 14px;
    align-items: start;
    padding: 0 0 7mm;
    border-bottom: 2px solid #d8c5a3;
  }

  .print-brand-mark {
    border: 1px solid #d7dce4;
    border-radius: 16px;
    padding: 10px;
    background: #fff;
  }

  .print-brand-mark img {
    display: block;
    width: 100%;
    height: auto;
  }

  .print-eyebrow {
    margin: 0 0 4px;
    font-size: 8.5pt;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #7b5c2f;
    font-weight: 700;
  }

  .print-brand-copy h1,
  .print-section-head h2 {
    margin: 0;
    color: #142033;
  }

  .print-brand-copy h1 {
    font-size: 22pt;
    line-height: 1.05;
  }

  .print-brand-copy p {
    margin: 8px 0 0;
    max-width: 420px;
    color: #4f5d73;
    line-height: 1.45;
  }

  .print-status {
    justify-self: end;
    align-self: start;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 9pt;
    font-weight: 700;
    border: 1px solid #d7dce4;
  }

  .print-status.is-closed {
    background: #eaf4ee;
    color: #1f5a3d;
    border-color: #bad8c5;
  }

  .print-status.is-open {
    background: #fff4e8;
    color: #8b5a17;
    border-color: #edd2ac;
  }

  .print-meta-grid,
  .print-kpi-grid,
  .print-signoff-grid {
    display: grid;
    gap: 10px;
  }

  .print-meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 7mm;
  }

  .print-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 5mm;
  }

  .print-signoff-grid {
    grid-template-columns: 1.35fr 1fr;
    margin-top: 6mm;
    align-items: start;
  }

  .print-meta-card,
  .print-kpi-card,
  .print-table-card,
  .print-notes-card,
  .print-signature-card,
  .print-approval-card {
    border: 1px solid #d7dce4;
    border-radius: 16px;
    background: #fff;
  }

  .print-meta-card,
  .print-kpi-card {
    padding: 12px 14px;
  }

  .print-meta-card strong,
  .print-kpi-card strong,
  .print-approval-list strong {
    display: block;
    margin-top: 4px;
    font-size: 13pt;
    line-height: 1.2;
  }

  .print-meta-card span:last-child,
  .print-brand-copy p,
  .print-kpi-label,
  .print-meta-label,
  .print-section-kicker,
  .print-approval-list span,
  .print-note-item span {
    color: #4f5d73;
  }

  .print-meta-label,
  .print-kpi-label,
  .print-section-kicker {
    display: block;
    font-size: 8.5pt;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
  }

  .print-kpi-card {
    min-height: 84px;
  }

  .print-kpi-card.accent {
    background: linear-gradient(135deg, #183153 0%, #24476f 100%);
    border-color: #183153;
  }

  .print-kpi-card.accent strong,
  .print-kpi-card.accent .print-kpi-label {
    color: #fff;
  }

  .print-table-card,
  .print-notes-card,
  .print-signature-card,
  .print-approval-card {
    margin-top: 6mm;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .print-table-card {
    page-break-inside: auto;
    break-inside: auto;
  }

  .print-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #e4e8ee;
    background: #f8fafc;
  }

  .print-section-head h2 {
    font-size: 13.5pt;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.2pt;
    table-layout: fixed;
  }

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

  .print-table tbody {
    display: table-row-group;
  }

  .print-table tr {
    display: table-row;
    page-break-inside: avoid;
  }

  .print-table th,
  .print-table td {
    display: table-cell;
    padding: 10px 12px;
    vertical-align: top;
    text-align: left;
    word-break: break-word;
    border-bottom: 1px solid #e7ebf0;
  }

  .print-table th {
    font-size: 8.8pt;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #4f5d73;
    background: #f8fafc;
  }

  .print-table tbody tr:nth-child(even) td {
    background: #fcfdff;
  }

  .print-empty {
    padding: 20px 16px;
    color: #4f5d73;
  }

  .print-notes-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 16px 16px;
  }

  .print-note-item {
    border: 1px solid #e4e8ee;
    border-radius: 12px;
    padding: 12px;
    background: #fcfdff;
  }

  .print-note-item strong,
  .print-note-item span {
    display: block;
  }

  .print-note-item p {
    margin: 8px 0 0;
    line-height: 1.5;
  }

  .print-signature-card,
  .print-approval-card {
    margin-top: 0;
  }

  .print-signature-frame {
    min-height: 110px;
    margin: 14px 16px 16px;
    border: 1px dashed #aeb8c6;
    border-radius: 14px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
  }

  .print-signature-frame img {
    display: block;
    max-width: 100%;
    max-height: 84px;
    height: auto;
  }

  .print-signature-frame.is-empty {
    color: #708095;
    font-style: italic;
  }

  .print-approval-list {
    display: grid;
    gap: 12px;
    padding: 14px 16px 16px;
  }

  .print-approval-list div {
    padding-bottom: 10px;
    border-bottom: 1px solid #e7ebf0;
  }

  .print-approval-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .print-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6mm;
    padding-top: 4mm;
    border-top: 1px solid #d7dce4;
    color: #4f5d73;
    font-size: 8.8pt;
  }

  td::before {
    content: none !important;
  }
}
