
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #172033;
  --muted: #667085;
  --border: #cfd6e3;
  --border-strong: #1f2937;
  --primary: #176b54;
  --primary-dark: #0f513f;
  --danger: #b42318;
  --weekend: #20242b;
  --shadow: 0 18px 50px rgba(25, 39, 63, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 56px);
  background: #102a24;
  color: #fff;
}

.eyebrow {
  margin: 0 0 6px;
  color: #b7d6cc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
}

.subtitle {
  margin: 7px 0 0;
  color: #d8e8e3;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.save-status {
  min-width: 92px;
  color: #cbe5dd;
  font-size: 13px;
  text-align: right;
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  transition: 0.18s ease;
}

.button {
  min-height: 40px;
  padding: 9px 15px;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: #2da77f;
  color: #fff;
}

.button-primary:hover {
  background: #258d6c;
}

.button-secondary {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.button-danger {
  border-color: #f2b8b5;
  background: #fff2f1;
  color: var(--danger);
}

.icon-button {
  width: 40px;
  height: 40px;
  border-color: var(--border);
  background: #fff;
  color: var(--primary);
  font-size: 23px;
}

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.control-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(25, 39, 63, 0.05);
}

.year-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.year-control label {
  font-weight: 800;
}

.year-control select {
  min-width: 120px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  padding: 0 12px;
  font-weight: 700;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-box {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

.weekday-box,
.entered-weekend-box {
  background: #fff;
}

.weekend-box {
  background: var(--weekend);
}

.month-tabs {
  display: grid;
  grid-template-columns: repeat(12, minmax(88px, 1fr));
  gap: 7px;
  margin: 14px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.month-tab {
  min-height: 43px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: #344054;
  font-weight: 750;
  white-space: nowrap;
}

.month-tab:hover {
  border-color: #82b8a8;
  color: var(--primary);
}

.month-tab.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 7px 18px rgba(23, 107, 84, 0.2);
}

.form-card {
  overflow: hidden;
  border: 1px solid #aab3c2;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.print-title {
  border-bottom: 1px solid var(--border-strong);
  text-align: center;
}

.print-title h2 {
  margin: 0;
  padding: 20px 18px;
  font-size: 17px;
  line-height: 1.35;
}

.form-subtitle-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 8px 18px;
  border-top: 1px solid var(--border-strong);
  font-size: 15px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  table-layout: fixed;
}

.col-number { width: 7%; }
.col-date { width: 14%; }
.col-plate { width: 16%; }
.col-place { width: 19%; }
.col-subject { width: 23%; }
.col-description { width: 21%; }

th,
td {
  border: 1px solid var(--border-strong);
}

th:first-child,
td:first-child {
  border-left: 0;
}

th:last-child,
td:last-child {
  border-right: 0;
}

thead th {
  padding: 9px 7px;
  background: #f3f5f8;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

tbody td {
  height: 36px;
  padding: 0;
  background: #fff;
  transition: background 0.12s ease;
}

.day-number {
  font-weight: 750;
  text-align: center;
}

.date-cell {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.date-cell small {
  display: block;
  margin-top: 2px;
  color: #667085;
  font-size: 10px;
  font-weight: 600;
}

.cell-input {
  width: 100%;
  min-height: 35px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.cell-input:focus {
  box-shadow: inset 0 0 0 2px #58a890;
  background: #f2fbf8;
}

tr.weekend-empty td {
  background: var(--weekend);
  color: #fff;
}

tr.weekend-empty .date-cell small {
  color: #d4d7dc;
}

tr.weekend-empty .cell-input {
  color: #fff;
  caret-color: #fff;
}

tr.weekend-empty .cell-input:focus {
  background: #323841;
}

tr.weekend-empty .cell-input::placeholder {
  color: #aeb4bd;
}

.signature-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 180px;
  padding: 26px 9% 30px;
}

.signature-block {
  display: grid;
  gap: 8px;
  text-align: center;
}

.signature-block > strong {
  font-size: 15px;
}

.signature-block label {
  display: grid;
  gap: 3px;
}

.signature-block label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.signature-input {
  width: 100%;
  border: 0;
  border-bottom: 1px dashed #98a2b3;
  outline: 0;
  background: transparent;
  padding: 4px 6px;
  color: var(--text);
  font-weight: 750;
  text-align: center;
  text-transform: uppercase;
}

.signature-input:focus {
  border-bottom-color: var(--primary);
  background: #f3faf7;
}

.signature-date {
  padding-top: 4px;
  font-weight: 700;
}

.bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.bottom-actions p {
  margin: 0;
}

@media (max-width: 980px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .control-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .month-tabs {
    grid-template-columns: repeat(12, 100px);
  }

  .signature-area {
    gap: 40px;
    padding-inline: 5%;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 16px, 1500px);
    margin-top: 12px;
  }

  .app-header {
    padding: 18px;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .button {
    flex: 1 1 130px;
  }

  .save-status {
    width: 100%;
    text-align: left;
  }

  .form-subtitle-row {
    grid-template-columns: 1fr;
  }

  .signature-area {
    grid-template-columns: 1fr;
  }

  .bottom-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}


.developer-credit {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid rgba(23, 107, 84, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 20px rgba(25, 39, 63, 0.10);
  color: var(--muted);
  font-size: 11px;
  backdrop-filter: blur(8px);
}

.developer-credit a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.developer-credit a:hover {
  text-decoration: underline;
}

.first-launch-notice {
  position: fixed;
  right: 18px;
  bottom: 62px;
  z-index: 60;
  width: min(380px, calc(100vw - 36px));
  padding: 17px 44px 16px 18px;
  border: 1px solid #9bc8ba;
  border-radius: 14px;
  background: #f3fbf8;
  box-shadow: 0 18px 45px rgba(25, 39, 63, 0.18);
  color: #173c32;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.first-launch-notice.visible {
  opacity: 1;
  transform: translateY(0);
}

.first-launch-notice strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.first-launch-notice p {
  margin: 0 0 8px;
  color: #315d51;
  font-size: 13px;
  line-height: 1.45;
}

.first-launch-notice a {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.first-launch-notice a:hover {
  text-decoration: underline;
}

.welcome-close {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #477469;
  font-size: 22px;
  line-height: 1;
}

.welcome-close:hover {
  background: #dcefe9;
}

@media (max-width: 620px) {
  .developer-credit {
    right: 10px;
    bottom: 10px;
  }

  .first-launch-notice {
    right: 10px;
    bottom: 56px;
    width: calc(100vw - 20px);
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 4mm;
  }

  html,
  body {
    width: 100%;
    height: auto;
  }

  body {
    background: #fff;
    color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .app-header,
  .control-panel,
  .month-tabs,
  .bottom-actions,
  .developer-credit,
  .first-launch-notice {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    margin: 0;
  }

  .form-card {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .print-title h2 {
    padding: 7px 8px;
    font-size: 12px;
    line-height: 1.1;
  }

  .form-subtitle-row {
    gap: 12px;
    padding: 4px 8px;
    font-size: 9.5px;
    line-height: 1.1;
  }

  .table-scroll {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  thead {
    display: table-header-group;
  }

  thead th {
    height: 15px;
    padding: 2px 3px;
    font-size: 8px;
    line-height: 1.05;
  }

  tbody tr,
  tbody td {
    height: 18px;
    min-height: 18px;
    max-height: 18px;
    line-height: 1;
  }

  tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cell-input {
    display: block;
    height: 17px;
    min-height: 0;
    padding: 0 3px;
    font-size: 8.3px;
    line-height: 17px;
  }

  .date-cell {
    padding: 0 3px;
    font-size: 8.3px;
    line-height: 1;
  }

  .date-cell small {
    display: none;
  }

  .day-number {
    font-size: 8.3px;
    line-height: 1;
  }

  .signature-area {
    gap: 160px;
    padding: 9px 8% 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .signature-block {
    gap: 2px;
    line-height: 1;
  }

  .signature-block > strong,
  .signature-input,
  .signature-date {
    font-size: 9px;
    line-height: 1;
  }

  .signature-block label {
    gap: 0;
  }

  .signature-block label span {
    display: none;
  }

  .signature-input {
    height: 11px;
    border: 0;
    padding: 0;
  }

  .signature-date {
    padding-top: 2px;
  }
}
