:root {
  --bg: #cfa82e;
  --panel: #ffffff;
  --line: #cad4de;
  --line-dark: #9aa8b6;
  --text: #102235;
  --muted: #5c6e81;
  --primary: #000000;
  --weekend: #f7f9fb;
  --shadow: 0 10px 28px rgba(16, 34, 53, 0.08);
  --radius: 18px;
  --sheet-scale: 1;
  --font-scale: 1.2;
  --computed-row-height: 21.2px;
  --computed-sign-height: 12.5px;
  --computed-line-height: 10.2px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

input, select, button { font: inherit; }
.wrap { width: min(1220px, calc(100% - 24px)); margin: 0 auto; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #000;
  color: #fff;
  border-bottom: 4px solid #cfa82e;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px 0;
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-logo,
.sheet-logo {
  display: block;
  width: auto;
  height: 60px;
  object-fit: contain;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(22px, 2.7vw, 32px); }
h2 { margin-bottom: 0; font-size: 18px; }
.header-subtitle,
.subtext { margin-bottom: 0; color: #f0d77a; font-weight: 700; }

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

.layout { padding: 34px 0 40px; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(16, 34, 53, 0.12);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 22px;
}

.section-head { margin-bottom: 14px; }
.section-head h2 { font-size: 26px; color: #1c2d40; }

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

.controls-grid-main {
  grid-template-columns: 1.4fr 0.8fr 0.8fr 1fr;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field-wide { grid-column: span 2; }
.field span { font-size: 13px; font-weight: 700; color: var(--muted); }

input[type="text"], select {
  min-height: 56px;
  width: 100%;
  border: 1px solid #b7c1cb;
  border-radius: 18px;
  padding: 10px 18px;
  background: #fff;
  color: var(--text);
  font-size: 18px;
}

input:focus, select:focus {
  outline: 2px solid rgba(0, 0, 0, 0.08);
  border-color: #000;
}

.btn {
  min-height: 56px;
  border-radius: 18px;
  border: 1px solid #d3ad2e;
  background: transparent;
  color: #fff;
  font-weight: 700;
  padding: 0 22px;
  cursor: pointer;
}

.paper {
  background: #fff;
  border: 1px solid #d5dee6;
  border-radius: 24px;
  box-shadow: 0 18px 42px rgba(16, 34, 53, 0.12);
  overflow: hidden;
}

.paper-inner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 1 / 1.414;
  padding: 16px 18px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transform: scale(var(--sheet-scale));
  transform-origin: top center;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dde5ec;
}

.sheet-branding {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 auto;
}

.company-block { min-width: 0; }
.company-title {
  margin: 0;
  font-size: clamp(18px, 1.75vw, 26px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #cfa82e;
}

.sheet-caption {
  margin: 4px 0 8px;
  font-size: calc(10px * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #cfa82e;
}

.company-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: calc(10px * var(--font-scale));
  color: #33475b;
}

.sheet-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(126px, 1fr));
  gap: 8px;
  flex: 0 0 290px;
}

.meta-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fbfcfd;
  min-height: 54px;
}

.meta-card span {
  display: block;
  font-size: calc(9px * var(--font-scale));
  color: var(--muted);
  margin-bottom: 4px;
}

.meta-card strong {
  display: block;
  min-height: 16px;
  font-size: calc(12px * var(--font-scale));
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead th {
  background: #f2df9f;
  border-bottom: 1px solid #cfa82e;
  padding: 4px;
  text-align: left;
  font-size: calc(9.3px * var(--font-scale));
  line-height: 1.05;
  white-space: nowrap;
}

tbody td {
  border-bottom: 1px solid #e3e9ef;
  padding: 2px 4px;
  height: var(--computed-row-height);
  font-size: calc(9.2px * var(--font-scale));
  line-height: 1;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
.col-date { width: 11%; }
.col-day { width: 8%; }
.col-sign { width: 12.5%; }
.weekend-row { background: var(--weekend); }
.weekend-mark::after {
  content: "Wknd";
  display: inline-block;
  margin-left: 4px;
  padding: 1px 4px;
  border: 1px solid #ced7df;
  border-radius: 999px;
  font-size: calc(7.8px * var(--font-scale));
  color: var(--muted);
}

.blank-line {
  display: block;
  width: 100%;
  height: var(--computed-line-height);
  border-bottom: 1px solid var(--line-dark);
}

.sign-box {
  display: block;
  width: 100%;
  height: calc(var(--computed-sign-height) + 2px);
  border: none;
  border-bottom: 2px solid #000;
  background: transparent;
}

.monthly-total {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: calc(12px * var(--font-scale));
  font-weight: 700;
  flex: 0 0 auto;
}

.monthly-total-box {
  display: inline-block;
  width: 78px;
  height: 24px;
  border: 1px solid #b9c4ce;
  border-radius: 5px;
  background: #fff;
}

@media (max-width: 980px) {
  .header-inner,
  .sheet-head { flex-direction: column; align-items: flex-start; }
  .controls-grid,
  .controls-grid-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-meta { width: 100%; flex: auto; }
  .paper-inner { aspect-ratio: auto; padding: 14px; transform: none; }
  .table-wrap { overflow: auto; height: auto !important; }
  table { min-width: 860px; height: auto; }
}

@media (max-width: 640px) {
  .controls-grid,
  .controls-grid-main { grid-template-columns: 1fr; }
  .field-wide { grid-column: span 1; }
  .header-actions { width: 100%; }
  .btn { flex: 1 1 auto; }
  .company-contact { flex-direction: column; gap: 3px; }
  .header-logo, .sheet-logo { height: 48px; }
}

@page {
  size: A4 portrait;
  margin: 5mm;
}

@media print {
  html, body {
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    background: #fff;
  }

  .no-print { display: none !important; }
  .wrap { width: 100%; margin: 0; }
  .layout { padding: 0; }
  .paper {
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .paper-inner {
    width: 100%;
    max-width: none;
    aspect-ratio: auto;
    min-height: 286mm;
    height: 286mm;
    padding: 0;
    margin: 0;
    transform: scale(1);
  }

  .table-wrap {
    border-radius: 0;
    page-break-inside: avoid;
    overflow: hidden;
  }

  table {
    min-width: 0;
    width: 100%;
    height: 100%;
  }
}


.site-footer {
  padding: 0 0 28px;
}

.footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
}

.footer-inner span:last-child {
  opacity: 0.92;
}
