:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #dce1e7;
  --text: #1e252f;
  --muted: #667085;
  --accent: #1d6f5f;
  --accent-dark: #145749;
  --warn: #b54708;
}

@media print {
  body.sign-page {
    background: #fff;
  }

  body.sign-page .sign-layout,
  body.sign-page .sign-card {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  body.sign-page .sign-card > div:first-child,
  body.sign-page .signature-form,
  body.sign-page .signature-modal,
  body.sign-page .toast {
    display: none !important;
  }

  body.sign-page .contract-preview {
    display: block;
    padding: 0;
    border: 0;
    background: #fff;
  }

  body.sign-page .contract-preview > .meta {
    display: none !important;
  }

  body.sign-page [data-sign-target].signed span {
    display: none;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(500px, auto) auto;
  align-items: center;
  gap: 22px;
  padding: 26px 32px 20px;
  background: #16352f;
  color: white;
}

.topbar > * { min-width: 0; }

.topbar h1 {
  margin: 0;
  font-size: 26px;
}

.topbar p {
  margin: 8px 0 0;
  color: #cfe2dd;
  overflow-wrap: anywhere;
}

.server-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: #e8f3f0;
  font-size: 13px;
}

.server-line span,
.server-line a {
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  overflow-wrap: anywhere;
}

.server-line a {
  color: #fff;
  text-decoration: none;
}

.server-line a:hover {
  background: rgba(255, 255, 255, 0.16);
}

.summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 1fr));
  gap: 8px;
  min-width: 330px;
}

.account-panel {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.account-panel button {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #16352f;
  min-height: 34px;
  padding: 7px 11px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

#ownerLabel,
#currentStoreLabel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e8f3f0;
  font-size: 13px;
  white-space: nowrap;
}

.summary div {
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  text-align: center;
}

.summary strong {
  display: block;
  font-size: 18px;
}

.summary span {
  display: block;
  margin-top: 2px;
  color: #cfe2dd;
  font-size: 12px;
}

main {
  max-width: 1180px;
  margin: 24px auto 48px;
  padding: 0 20px;
}

.stage,
.workspace {
  display: block;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.stage-head h2,
.store-choice h3 {
  margin: 0;
}

.stage-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.store-choice {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.license-line {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #c8d9d4;
  border-radius: 8px;
  background: #eef4f2;
  color: var(--accent-dark);
  font-size: 13px;
}

.choice-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.choice-card {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.choice-card:hover,
.selected-item {
  border-color: #91bdb3;
  background: #f4fbf8;
}

.choice-card strong {
  font-size: 17px;
}

.choice-card span {
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.tabs button,
form button {
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 16px;
  cursor: pointer;
  border: 1px solid var(--line);
}

.tabs button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.tabs button.active,
form button {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

form button:hover,
.tabs button.active:hover {
  background: var(--accent-dark);
}

.tabs button:not(.data-management-tab) {
  border: 2px solid #4a9b8c;
  background: #effaf6;
  color: #135c50;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(29, 111, 95, 0.13);
}

.tabs button:not(.data-management-tab):hover {
  border-color: #257565;
  background: #def2ec;
}

.tabs button:not(.data-management-tab).active,
.tabs button:not(.data-management-tab).active:hover {
  border-color: #15594e;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(20, 88, 75, 0.2);
}

.tabs .data-management-tab {
  margin-left: auto;
  border: 2px solid #c58a27;
  background: #fff7e6;
  color: #754500;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(150, 91, 9, 0.16);
}

.tabs .data-management-tab:hover {
  border-color: #a66b10;
  background: #ffedc7;
}

.tabs .data-management-tab.active,
.tabs .data-management-tab.active:hover {
  border-color: #875000;
  background: #9a5b00;
  color: #fff;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.store-context {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #eef4f2;
  color: var(--accent-dark);
  border: 1px solid #c8d9d4;
  font-size: 13px;
}

.weekly-work-summary {
  color: var(--muted);
  font-weight: 700;
}

.grid-form,
.inline-form {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.grid-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

#contractForm {
  gap: 10px;
}

.contract-tab-heading,
.contract-worker-launcher-head,
.contract-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.contract-tab-heading {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid #c9ddd7;
  border-radius: 10px;
  background: linear-gradient(135deg, #f4fbf8, #fff);
}

.contract-tab-heading h2,
.contract-worker-launcher h3,
.contract-list-heading h3 { margin: 0; }

.contract-tab-heading p,
.contract-worker-launcher p,
.contract-list-heading p { margin: 5px 0 0; }

.contract-tab-heading > button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.worker-tab-heading,
.worker-list-heading,
.store-tab-heading,
.store-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.worker-tab-heading,
.store-tab-heading {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid #c9ddd7;
  border-radius: 10px;
  background: linear-gradient(135deg, #f4fbf8, #fff);
}

.worker-tab-heading h2,
.worker-list-heading h3,
.store-tab-heading h2,
.store-list-heading h3 { margin: 0; }

.worker-tab-heading p,
.worker-list-heading p,
.store-tab-heading p,
.store-list-heading p { margin: 5px 0 0; }

.store-tab-heading > button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.worker-tab-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.worker-tab-heading-actions > button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.worker-list-heading,
.store-list-heading {
  align-items: flex-end;
  margin: 4px 0 10px;
}

.worker-card {
  gap: 10px;
}

.worker-contract-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid #c9ddd7;
  border-radius: 8px;
  background: #f6fbf9;
}

.worker-contract-inline.empty {
  border-style: dashed;
  background: #fbfcfc;
}

.worker-contract-inline.empty .open-worker-contract {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.worker-contract-summary {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.worker-contract-summary > strong {
  color: #123f36;
}

.worker-contract-statuses,
.worker-contract-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.worker-contract-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.worker-contract-actions .small-button {
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}

.contract-worker-launcher {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.contract-worker-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.contract-worker-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: space-between;
  gap: 10px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid #d9e4e1;
  border-radius: 9px;
  background: #f8fbfa;
}

.contract-worker-action > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.contract-worker-action strong { overflow-wrap: anywhere; }
.contract-worker-action span { color: var(--muted); font-size: 12px; }
.contract-worker-action button {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 800;
  cursor: pointer;
  white-space: normal;
}

.contract-list-heading {
  align-items: flex-end;
  margin: 4px 0 10px;
}

.modal-box.contract-editor-box {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 16px;
  overflow: hidden;
}

.modal-box.worker-editor-box {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 16px;
  overflow: hidden;
}

.modal-box.store-editor-box {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 16px;
  overflow: hidden;
}

.store-editor-head { padding: 2px 2px 0; }

#storeForm.store-editor-form {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.store-card {
  gap: 9px;
}

.worker-editor-head { padding: 2px 2px 0; }

#workerForm.worker-editor-form {
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.contract-editor-head { padding: 2px 2px 0; }

#contractForm.contract-editor-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.form-spacer {
  min-height: 1px;
}

.pay-day-extra {
  display: block;
  margin-top: 6px;
}

.hourly-break-detail {
  display: grid;
  grid-template-columns: 38px minmax(30px, 1fr) 8px minmax(30px, 1fr);
  align-items: center;
  gap: 2px;
  margin-top: 7px;
  padding: 6px;
  border: 1px solid #d4e1dd;
  border-radius: 8px;
  background: #f6faf9;
  font-size: 12px;
  color: var(--muted);
}

.hourly-break-detail > :first-child {
  white-space: nowrap;
}

.hourly-break-detail select {
  min-height: 30px;
  width: 100%;
  min-width: 0;
  padding: 4px 3px;
  font-size: 12px;
  text-align: center;
  appearance: none;
  background-image: none;
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 9px;
  cursor: pointer;
}

.break-range-mark {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.hourly-break-detail:hover select,
.hourly-break-detail select:hover,
.hourly-break-detail select:focus {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235f6f6a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.invisible-field {
  visibility: hidden;
  pointer-events: none;
}

.grid-form.compact {
  margin: 0;
  padding: 14px;
}

.inline-form {
  grid-template-columns: 1.2fr 180px auto;
  align-items: end;
}

.worker-form {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.contract-form-section {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px 14px 12px;
  border: 1px solid #d7e2e7;
  border-radius: 8px;
  background: #fbfdfd;
}

.contract-form-section-full {
  grid-column: 1 / -1;
}

.contract-form-section-compact .contract-subgrid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.contract-form-section legend {
  padding: 0 6px;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 13px;
}

.contract-subgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
}

.tooltip-wrap {
  position: relative;
  display: block;
}

.tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 5;
  display: none;
  width: max-content;
  max-width: min(320px, 82vw);
  padding: 8px 10px;
  border-radius: 8px;
  background: #263238;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.tooltip-wrap:hover .tooltip,
.tooltip-wrap:focus-within .tooltip {
  display: block;
}

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

.wide {
  grid-column: span 2;
}

.bank-account-group {
  display: grid;
  grid-template-columns: minmax(140px, 0.65fr) minmax(220px, 1.35fr);
  gap: 14px;
}

.retirement-group {
  display: grid;
  grid-template-columns: minmax(90px, 0.45fr) minmax(160px, 1fr);
  gap: 14px;
  align-items: end;
}

.checkbox-label {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

.store-check {
  min-height: 40px;
  align-self: end;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.active {
  background: #eef4f2;
  color: var(--accent-dark);
}

.status-badge.retired {
  background: #f2f4f7;
  color: #667085;
}

.status-badge.warn {
  background: #fff4ed;
  color: var(--warn);
}

.status-badge.scheduled {
  background: #eef4ff;
  color: #315a9b;
}

fieldset.wide {
  grid-column: 1 / -1;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.subpanel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.subpanel h3 {
  margin: 0;
  font-size: 17px;
}

.danger-zone {
  border-color: #f1b7aa;
  background: #fff8f6;
}

button.danger {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}

.compact-list {
  gap: 8px;
}

legend {
  color: var(--muted);
  padding: 0 6px;
}

#weekdayPattern,
#shiftWeekdayPattern {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.day-box {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.day-box label {
  min-width: 0;
  color: var(--text);
}

.day-box .day-sync {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
}

.day-box .day-sync input {
  width: auto;
  min-height: auto;
}

.day-box input,
.day-box select {
  width: 100%;
  min-width: 0;
}

.day-check {
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-box input[type="checkbox"] {
  width: auto;
  min-height: 0;
}

.list {
  display: grid;
  gap: 12px;
}

.item {
  display: grid;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.hidden {
  display: none !important;
}

.actions,
.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.item h3 {
  margin: 0;
  font-size: 18px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.money {
  color: var(--accent-dark);
  font-weight: 700;
}

.contract-card {
  gap: 6px;
  padding: 12px 14px;
}

.contract-card .item-header {
  align-items: center;
}

.contract-card-actions {
  flex-wrap: wrap;
  gap: 5px;
}

.contract-card-actions .money {
  margin-right: 3px;
  font-size: 13px;
  white-space: nowrap;
}

.contract-card-actions .status-badge {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.contract-card-actions .small-button {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.contract-change-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 12px;
  border: 1px solid #d4e1dd;
  border-radius: 8px;
  background: #f7fbfa;
}

.contract-change-meta .contract-change-reason,
.contract-change-meta > p {
  grid-column: 1 / -1;
}

.contract-change-meta > p {
  margin: 0;
  line-height: 1.55;
}

.schedule-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #c5ded6;
  border-radius: 8px;
  background: #eef8f5;
  color: var(--accent-dark);
}

.page-section-heading {
  margin-bottom: 10px;
}

.schedule-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.schedule-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.schedule-toolbar-actions button,
.actual-work-panel .work-table-heading > button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

.schedule-toolbar-actions button.ghost {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.schedule-view-toggle {
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  width: 100%;
  margin-bottom: 12px;
}

.schedule-view-toggle button {
  width: 100%;
}

.schedule-view-panel {
  display: grid;
  gap: 10px;
}

.compact-details {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.compact-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--accent-dark);
  background: #f7faf9;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.compact-details > summary::-webkit-details-marker {
  display: none;
}

.compact-details > summary::after {
  content: "펼치기";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.compact-details[open] > summary::after {
  content: "접기";
}

.compact-table-wrap {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.planned-work-table {
  min-width: 980px;
}

.planned-work-table th,
.planned-work-table td,
.actual-work-table th,
.actual-work-table td {
  padding: 7px;
}

.planned-work-table input,
.planned-work-table select,
.actual-work-table input,
.actual-work-table select {
  min-height: 32px;
  padding: 5px 6px;
  font-size: 12px;
}

.schedule-summary div:first-child {
  display: grid;
  gap: 4px;
}

.schedule-summary strong {
  font-size: 16px;
}

.schedule-summary span,
.schedule-summary-note {
  color: #41645c;
  font-size: 13px;
}

.schedule-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.schedule-week-head,
.schedule-day {
  min-width: 0;
  background: #fff;
}

.schedule-week-head {
  padding: 8px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.schedule-day {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 102px;
  padding: 8px;
}

.schedule-day.empty {
  background: #f7f9fa;
}

.schedule-day.saturday .schedule-day-number {
  color: #2563eb;
}

.schedule-day.sunday .schedule-day-number {
  color: #dc2626;
}

.schedule-day-number {
  font-size: 12px;
  font-weight: 700;
}

.schedule-shift {
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid #b9d8cf;
  border-radius: 7px;
  background: #f2fbf8;
  color: #123f36;
  font-size: 12px;
  line-height: 1.35;
}

.schedule-shift strong,
.schedule-shift span,
.schedule-shift small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-shift small {
  color: #41645c;
}

.attendance-judgement {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.work-table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.work-table-heading h2,
.work-table-heading p {
  margin: 0;
}

.work-table-heading p {
  margin-top: 4px;
}

.actual-work-panel {
  display: grid;
  gap: 10px;
  margin-top: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.actual-work-panel .work-table-heading {
  margin-bottom: 0;
}

.actual-work-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actual-work-summary span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf9;
  color: var(--muted);
  font-size: 13px;
}

.actual-work-table {
  min-width: 1050px;
}

.actual-row.status-confirmed {
  background: #f1faf6;
}

.actual-row.status-excluded {
  background: #fff4f2;
}

.actual-attendance-status {
  white-space: nowrap;
  font-weight: 700;
}

.attendance-judgement-head,
.attendance-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attendance-judgement-head div,
.attendance-result-row div {
  display: grid;
  gap: 3px;
}

.attendance-judgement-head span,
.attendance-result-row span,
.attendance-result-row small {
  color: var(--muted);
  font-size: 13px;
}

.attendance-result-table {
  display: grid;
  gap: 8px;
}

.attendance-result-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fbfcfd;
}

.attendance-result-row.tone-ok {
  border-left-color: #1f7a62;
}

.attendance-result-row.tone-info {
  border-left-color: #2563eb;
}

.attendance-result-row.tone-warn {
  border-left-color: #d97706;
}

.attendance-result-row.tone-danger {
  border-left-color: #dc2626;
}

.attendance-status {
  justify-self: end;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef7f4;
  color: var(--green) !important;
  font-weight: 700;
}

.attendance-correction-button {
  border: 1px solid #e6a23c;
  background: #fff8e8;
  color: #925400 !important;
  cursor: pointer;
}

.attendance-correction-button:hover,
.attendance-correction-button:focus-visible {
  border-color: #c56b00;
  background: #ffefc4;
  outline: 2px solid rgba(197, 107, 0, 0.15);
}

.attendance-fixable {
  background: #fffdf8;
}

.attendance-rule-note {
  justify-items: end;
  text-align: right;
}

.attendance-rule-note small,
.attendance-weekly-reason {
  color: var(--muted);
  font-size: 12px;
}

.attendance-result-side {
  justify-items: end;
  text-align: right;
}

.attendance-result-row .attendance-weekly-flags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.weekly-holiday-chip {
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f6f8;
  font-size: 12px !important;
  font-weight: 700;
}

.weekly-holiday-chip.inclusion-included,
.weekly-holiday-chip.week-eligible {
  border-color: #a7d7c9;
  background: #edf8f4;
  color: #176b55 !important;
}

.weekly-holiday-chip.inclusion-excluded,
.weekly-holiday-chip.week-not_applicable {
  border-color: #d9dee7;
  background: #f4f6f8;
  color: #667085 !important;
}

.weekly-holiday-chip.week-review {
  border-color: #f2c879;
  background: #fff8e8;
  color: #9a5b00 !important;
}

.weekly-holiday-chip.week-ineligible {
  border-color: #f0aaa5;
  background: #fff1f0;
  color: #b42318 !important;
}

.weekly-decision-panel {
  margin: 0;
  border-color: #cbded8;
  background: #f8fbfa;
}

.weekly-decision-panel > summary > span {
  display: grid;
  gap: 2px;
}

.weekly-decision-panel > summary small {
  color: var(--muted);
  font-weight: 500;
}

.weekly-decision-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.weekly-decision-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.1fr) 170px minmax(280px, 1.3fr) auto;
  align-items: end;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.weekly-decision-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.weekly-decision-info span,
.weekly-decision-info small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.weekly-decision-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.weekly-decision-row select,
.weekly-decision-row input {
  min-width: 0;
  min-height: 38px;
}

.weekly-decision-row button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.actual-row.attendance-correction-target {
  position: relative;
  outline: 3px solid rgba(29, 111, 95, 0.35);
  outline-offset: -3px;
  background: #eaf8f3;
}

@media (max-width: 720px) {
  .work-table-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .attendance-judgement-head,
  .attendance-result-row {
    align-items: stretch;
    flex-direction: column;
  }

  .attendance-rule-note,
  .attendance-result-side {
    justify-items: start;
    text-align: left;
  }

  .attendance-result-row .attendance-weekly-flags {
    justify-content: flex-start;
  }

  .attendance-status {
    justify-self: start;
  }

  .weekly-decision-row {
    grid-template-columns: 1fr;
  }

  .weekly-decision-row button {
    width: 100%;
  }
}

.view-toggle {
  display: inline-flex;
  width: fit-content;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.view-toggle button {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.view-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.view-toggle.schedule-view-toggle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  width: min(100%, 560px);
  padding: 4px;
  border-color: #d5dfdc;
  border-radius: 10px;
  background: #eef3f1;
}

.view-toggle.schedule-view-toggle button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 7px;
  white-space: nowrap;
  font-weight: 700;
}

.view-toggle.schedule-view-toggle button:not(.active):hover {
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.78);
}

.shift-assignment-board {
  display: grid;
  gap: 10px;
}

.assignment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #c5ded6;
  border-radius: 8px;
  background: #eef8f5;
  color: var(--accent-dark);
}

.assignment-head span {
  color: #41645c;
  font-size: 13px;
}

.assignment-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(7, minmax(120px, 1fr));
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  gap: 1px;
}

.assignment-row {
  display: contents;
}

.assignment-top-cell,
.assignment-shift,
.assignment-cell {
  min-width: 0;
  background: #fff;
}

.assignment-top-cell {
  padding: 9px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.assignment-shift {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.assignment-shift h3 {
  margin: 0;
  font-size: 15px;
}

.assignment-shift span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.assignment-cell {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 110px;
  padding: 9px;
}

.assignment-cell.disabled {
  background: #f7f9fa;
  color: var(--muted);
}

.assignment-day-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.assignment-time {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.assignment-people {
  display: grid;
  gap: 5px;
}

.assignment-person {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 42px;
  padding: 7px;
  border: 1px solid #b9d8cf;
  border-radius: 7px;
  background: #f2fbf8;
  color: #123f36;
  text-align: left;
  cursor: pointer;
}

.assignment-person strong,
.assignment-person span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-person span,
.assignment-empty,
.assignment-off {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
  background: #fbfcfd;
}

td input {
  min-height: 34px;
}

.small-button {
  padding: 7px 10px;
  border-radius: 8px;
  background: #eef4f2;
  color: var(--accent-dark);
  border: 1px solid #c8d9d4;
}

.small-button.danger {
  background: #fff4ed;
  color: var(--warn);
  border-color: #ffd7bd;
}

.ghost {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1500;
  display: none;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: white;
  background: #263238;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.toast.show {
  display: block;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 40, 0.45);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, #16352f, #10241f);
}

.auth-box {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.auth-box h2 {
  margin: 0;
  font-size: 22px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 12px 16px;
  cursor: pointer;
}

.warning-box {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff4ed;
  color: var(--warn);
  border: 1px solid #ffd7bd;
  font-size: 13px;
  line-height: 1.45;
}

.app-locked {
  pointer-events: none;
  user-select: none;
}

.modal-box {
  display: grid;
  gap: 16px;
  width: min(460px, 100%);
  padding: 20px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

.modal-box h2 {
  margin: 0;
  font-size: 20px;
}

.qr-modal-box {
  width: min(560px, 100%);
}

.qr-preview {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-preview img {
  width: min(280px, 80vw);
  height: auto;
  image-rendering: pixelated;
}

.attendance-qr-preview {
  gap: 10px;
}

.attendance-clock {
  color: var(--green);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
}

.attendance-recent {
  display: grid;
  gap: 10px;
}

.attendance-recent h3 {
  margin: 0;
  font-size: 15px;
}

.attendance-log-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.attendance-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  font-size: 14px;
}

.signature-link {
  overflow-wrap: anywhere;
  color: var(--accent-dark);
  font-size: 13px;
}

.signature-link-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbfa;
}

.owner-link-panel {
  border-color: #b9d8cd;
  background: #effaf6;
}

.store-signature-status {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.store-signature-status.registered {
  background: #e8f7f1;
  color: #12604e;
}

.store-signature-status.pending {
  background: #fff4ed;
  color: var(--warn);
}

.revision-history-box {
  width: min(780px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.revision-history-list,
.revision-change-list {
  display: grid;
  gap: 12px;
}

.revision-card {
  display: grid;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
}

.revision-card.pending {
  border-color: #e2b78d;
  background: #fffaf5;
}

.revision-card-head,
.revision-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.revision-card-head > div {
  display: grid;
  gap: 3px;
}

.revision-card-head span,
.revision-card-footer span {
  color: var(--muted);
  font-size: 12px;
}

.revision-signature-evidence {
  display: flex;
  align-items: center;
  gap: 12px;
}

.revision-signature-evidence img {
  width: 150px;
  max-height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.revision-signature-evidence.public-evidence {
  justify-content: space-between;
  padding: 12px;
  border: 1px solid #9fcbbd;
  border-radius: 8px;
  background: #effaf6;
}

.revision-signature-evidence.public-evidence > div {
  display: grid;
  gap: 4px;
  text-align: right;
}

.revision-signature-evidence.public-evidence span {
  color: var(--muted);
  font-size: 12px;
}

.revision-status {
  padding: 5px 8px;
  border-radius: 999px;
  background: #e8f7f1;
  color: #12604e !important;
  font-weight: 700;
}

.revision-card.pending .revision-status {
  background: #fff0df;
  color: var(--warn) !important;
}

.revision-reason {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef4f2;
}

.revision-reason span {
  overflow-wrap: anywhere;
}

.revision-change-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.55fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.revision-change-row > strong,
.revision-change-row > div {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.revision-change-row > strong {
  align-content: center;
  color: var(--accent-dark);
}

.revision-change-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.revision-change-row p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.revision-change-row .revision-after {
  border-color: #9fcbbd;
  background: #effaf6;
}

.compact-qr-preview {
  padding: 10px;
}

.compact-qr-preview img {
  width: min(150px, 45vw);
}

.signature-url-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.signature-url-field input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--text);
  font: inherit;
}

.signature-send-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.signature-send-actions button,
.signature-send-actions a {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
}

.signature-send-actions button:not(.ghost),
.signature-send-actions a {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.sign-page {
  background: #eef2f4;
}

.sign-layout {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px;
}

.sign-card {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sign-card h1,
.contract-preview h2,
.contract-preview h3 {
  margin: 0;
}

.contract-preview {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

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

.preview-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-grid strong {
  color: var(--muted);
  font-size: 12px;
}

.preview-grid span {
  overflow-wrap: anywhere;
}

.signature-form {
  display: grid;
  gap: 14px;
}

.sign-review-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfe2dc;
  border-radius: 8px;
  background: #f7fbfa;
}

.sign-review-panel h2 {
  margin: 0;
  font-size: 17px;
}

.sign-target-list {
  display: grid;
  gap: 8px;
}

.sign-target-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sign-target-item.confirmed {
  border-color: #9fd1c2;
  background: #eef9f5;
}

.sign-target-item.signed {
  border-color: #67b89e;
  background: #eef9f5;
}

.sign-target-action {
  min-height: 36px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
}

.check-line {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.check-line input {
  width: auto;
}

.review-focus {
  outline: 3px solid rgba(22, 120, 97, 0.35);
  outline-offset: 3px;
}

.review-confirmed {
  border-color: #0f7a5f !important;
  background: #eef9f5 !important;
}

.signature-canvas-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pdf-completion-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #cfe2dc;
  border-radius: 8px;
  background: #f7fbfa;
}

.pdf-completion-panel p {
  margin: 0;
}

.pdf-completion-panel button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}

.signature-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 40, 0.68);
}

.signature-modal.hidden {
  display: none;
}

.signature-modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.signature-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.signature-modal-head h2 {
  margin: 0 0 6px;
}

#signatureModalContext {
  max-height: 110px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
}

.signature-modal-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 14px;
}

.signature-modal-actions button {
  min-height: 44px;
  border-radius: 8px;
}

#saveTargetSignatureButton {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

#signatureCanvas,
#ownerSignatureCanvas,
#storeOwnerSignatureCanvas,
#revisionSignatureCanvas,
#retirementSignatureCanvas,
#resignationSignatureCanvas {
  display: block;
  width: 100%;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.owner-sign-card {
  max-width: 680px;
  margin: 5vh auto 0;
}

.revision-public-reason {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid #cfe2dc;
  border-radius: 8px;
  background: #eef8f5;
}

.revision-public-reason p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .revision-change-row {
    grid-template-columns: 1fr;
  }

  .revision-change-row > strong {
    min-height: 42px;
  }

  .revision-card-head,
  .revision-card-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

.license-activation-box {
  width: min(720px, 100%);
  max-width: none;
  padding: 28px;
}

.license-activation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.license-key-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.license-key-field input {
  width: 100%;
  min-width: 0;
}

.license-key-field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.license-key-field small b {
  color: var(--text);
}

.license-activation-status {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6faf8;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.license-activation-status strong {
  display: block;
  color: var(--text);
  font-size: 16px;
}

.license-activation-status.error {
  border-color: #d99b9b;
  background: #fff3f3;
  color: #9a2f2f;
}

.license-activation-status.good {
  border-color: #8bcbb8;
  background: #effaf5;
  color: #126a52;
}

.license-activation-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.license-activation-actions > * {
  flex: 0 0 auto;
  min-width: max-content;
  white-space: nowrap;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 640px) {
  .license-activation-box {
    width: 100%;
    padding: 18px;
  }

  .license-activation-form {
    padding: 14px;
  }

  .license-activation-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .license-activation-actions > * {
    min-width: 0;
    white-space: normal;
    text-align: center;
  }
}

.owner-contract-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.owner-contract-summary > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.owner-contract-summary span {
  color: var(--muted);
  font-size: 13px;
}

.retirement-contract-list {
  display: grid;
  gap: 8px;
}

.retirement-contract-list > div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.retirement-contract-list span {
  color: var(--muted);
  font-size: 13px;
}

.worker-resignation-card {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.resignation-history {
  display: grid;
  gap: 10px;
}

.resignation-history .worker-record {
  grid-template-columns: minmax(0, 1fr) auto;
}

.resignation-worker-signature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 220px);
  gap: 12px;
  align-items: center;
}

.resignation-worker-signature img {
  width: 100%;
  max-height: 100px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

@media (max-width: 640px) {
  .resignation-worker-signature {
    grid-template-columns: 1fr;
  }
}

.pdf-completion-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.attendance-card {
  max-width: 520px;
  margin: 8vh auto 0;
}

.attendance-registration,
.attendance-backup-guide {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbfa;
}

.attendance-registration h2 {
  margin: 0;
  font-size: 20px;
}

.attendance-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid #9fcbbd;
  border-radius: 10px;
  background: #effaf6;
}

.attendance-identity > div {
  display: grid;
  gap: 3px;
}

.attendance-identity button {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 13px;
}

.attendance-identity strong {
  color: var(--green);
  font-size: 24px;
}

.attendance-backup-guide p {
  margin: 0;
}

.attendance-registration-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.attendance-registration-actions button {
  min-height: 48px;
}

.attendance-mobile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.attendance-mobile-actions button {
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}

.attendance-mobile-actions .ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.attendance-result {
  display: grid;
  gap: 4px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid #b9d8cd;
  border-radius: 8px;
  background: #effaf6;
  color: var(--green);
}

.attendance-result:empty {
  display: none;
}

.error-box {
  border-color: #ffc4c4;
  background: #fff1f1;
  color: #b42318;
}

.counter-page {
  min-height: 100vh;
  background: #eef3f1;
  color: var(--text);
}

.counter-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.counter-login {
  display: grid;
  gap: 16px;
  max-width: 440px;
  margin: 10vh auto 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.counter-dashboard {
  display: grid;
  gap: 16px;
}

.counter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-radius: 8px;
  background: #143c34;
  color: #fff;
}

.counter-header h1 {
  margin: 0;
}

.counter-header .meta {
  color: #d8ece6;
}

.counter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.counter-actions select,
.counter-actions button {
  min-height: 40px;
}

.counter-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
}

.counter-qr-card,
.counter-status-card,
.counter-recent-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.counter-qr-card {
  place-items: center;
  text-align: center;
}

.counter-qr-card img {
  width: min(320px, 80vw);
  image-rendering: pixelated;
}

.counter-temporary-link {
  width: min(320px, 80vw);
  min-height: 44px;
}

.counter-section-head,
.counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.counter-list,
.counter-recent-list {
  display: grid;
  gap: 8px;
}

.counter-row {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fbfcfd;
}

.counter-row div {
  display: grid;
  gap: 3px;
}

.counter-row span {
  color: var(--muted);
  font-size: 13px;
}

.counter-row.tone-ok {
  border-left-color: #1f7a62;
}

.counter-row.tone-info {
  border-left-color: #2563eb;
}

.counter-row.tone-warn {
  border-left-color: #d97706;
}

.counter-row.tone-danger {
  border-left-color: #dc2626;
}

.counter-backup-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.3fr);
  gap: 12px;
  margin-top: 2px;
}

.counter-backup-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.counter-backup-form select,
.counter-backup-form input {
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.counter-backup-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 10px;
}

.counter-backup-actions button {
  min-height: 44px;
}

.worker-dashboard {
  display: grid;
  gap: 16px;
}

.worker-month-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d8ece6;
  font-size: 13px;
}

.worker-month-label input {
  min-height: 40px;
  background: #fff;
}

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

.worker-summary article,
.worker-record-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.worker-summary article {
  display: grid;
  gap: 7px;
  padding: 16px;
}

.worker-summary span {
  color: var(--muted);
  font-size: 13px;
}

.worker-summary strong {
  color: #143c34;
  font-size: 22px;
}

.worker-record-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.worker-record-list {
  display: grid;
  gap: 9px;
}

.worker-record {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(320px, 1.4fr) minmax(100px, 0.45fr);
  gap: 16px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid #2563eb;
  border-radius: 8px;
  background: #fbfcfd;
}

.worker-record.tone-ok {
  border-left-color: #1f7a62;
}

.worker-record.tone-warn {
  border-left-color: #d97706;
}

.worker-record.tone-danger {
  border-left-color: #dc2626;
}

.worker-record-date,
.worker-record-status {
  display: grid;
  gap: 4px;
}

.worker-record-date span,
.worker-record-status span {
  color: var(--muted);
  font-size: 13px;
}

.worker-time-line {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 5px 10px;
  font-size: 14px;
}

.worker-time-line span {
  color: var(--muted);
}

.worker-record-status {
  justify-items: end;
  text-align: right;
}

.worker-empty {
  padding: 28px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.payslip-card {
  display: grid;
  gap: 12px;
}

.payroll-dashboard-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  padding: 14px 16px;
}

.payroll-dashboard-head h2,
.payroll-dashboard-head p,
.payroll-section-title h3 {
  margin: 0;
}

.payroll-dashboard-head p {
  margin-top: 4px;
}

.payroll-toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.payroll-toolbar > label {
  width: 170px;
}

.payroll-toolbar > button {
  min-height: 38px;
  padding: 8px 12px;
}

.payroll-manual-details {
  position: relative;
}

.payroll-manual-details > summary {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.payroll-manual-details > summary::-webkit-details-marker {
  display: none;
}

.payroll-manual-fields {
  position: absolute;
  z-index: 15;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px auto;
  align-items: end;
  gap: 8px;
  width: min(620px, calc(100vw - 40px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(31, 55, 49, 0.16);
}

.payroll-summary-panel {
  margin-bottom: 16px;
}

.payroll-summary-panel > p {
  margin: 0 0 7px;
}

.payroll-workers-section {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.payroll-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.payroll-list {
  gap: 7px;
}

.compact-payslip-card {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.payroll-employee-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.6fr) repeat(3, minmax(115px, 0.75fr)) 90px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.payroll-employee-identity {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.payroll-employee-identity h3,
.payroll-employee-identity .meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payroll-quick-metric {
  display: grid;
  gap: 3px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.payroll-quick-metric small {
  color: var(--muted);
  font-size: 11px;
}

.payroll-quick-metric strong {
  font-size: 14px;
  white-space: nowrap;
}

.payroll-net-metric strong {
  color: var(--accent-dark);
  font-size: 16px;
}

.payroll-row-status {
  justify-self: end;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.payroll-row-status.complete {
  color: #0f6a55;
  background: #e9f7f2;
}

.payroll-row-status.needs-review {
  color: #8a5811;
  background: #fff3cf;
}

.payroll-card-details {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.payroll-card-details > summary {
  min-height: 36px;
  padding: 8px 14px;
  background: #fbfcfc;
  font-size: 13px;
}

.payroll-card-details > summary small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
}

.payroll-card-details > summary::after {
  margin-left: 10px;
}

.payroll-card-detail-content {
  display: grid;
  gap: 10px;
  padding: 12px 14px 14px;
}

.payroll-summary-details {
  margin-top: 8px;
}

.welfare-report-panel {
  padding: 0;
}

.welfare-report-panel > summary > div {
  display: grid;
  gap: 2px;
}

.welfare-report-panel #welfareReport {
  padding: 14px;
  min-width: 0;
  max-width: 100%;
}

.payroll-create-panel,
.payroll-summary-panel,
.welfare-report-panel {
  margin-bottom: 16px;
}

.payroll-form {
  grid-template-columns: 180px 160px minmax(240px, 1fr) 160px auto;
  align-items: end;
  margin: 0;
  padding: 0;
  border: 0;
}

.payroll-form-actions {
  align-self: end;
  flex-wrap: wrap;
}

.payroll-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.payroll-type-badge,
.payroll-source-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-weight: 700;
}

.payroll-auto-badge {
  padding: 3px 7px;
  border-radius: 999px;
  color: #52645f;
  background: #f2f5f4;
  border: 1px solid #dbe4e1;
  font-size: 11px;
  font-weight: 700;
}

.payroll-type-badge {
  padding: 4px 9px;
  font-size: 12px;
}

.payroll-type-badge.forecast {
  color: #85520b;
  background: #fff5d9;
  border: 1px solid #f0d58a;
}

.payroll-type-badge.confirmed {
  color: #0f6a55;
  background: #e9f7f2;
  border: 1px solid #b8ddcf;
}

.payroll-source-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.payroll-source-summary span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef4f2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payroll-source-tag {
  margin-bottom: 3px;
  padding: 2px 7px;
  color: #4d625d;
  background: #edf3f1;
  font-size: 11px;
}

.payroll-source-tag.actual_confirmed,
.payroll-source-tag.weekly_confirmed {
  color: #0f6a55;
  background: #e4f4ee;
}

.payroll-source-tag.actual_draft {
  color: #8a5811;
  background: #fff3cf;
}

.payroll-source-tag.planned,
.payroll-source-tag.weekly_projected {
  color: #315d8a;
  background: #e9f2fb;
}

.payroll-warning {
  padding: 10px 12px;
  border: 1px solid #f0d18a;
  border-radius: 8px;
  color: #725016;
  background: #fffaf0;
  font-size: 13px;
}

.payroll-warning ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.payroll-weekly-table {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.payroll-weekly-row {
  display: grid;
  grid-template-columns: 190px 110px 110px minmax(260px, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.payroll-weekly-row:last-child {
  border-bottom: 0;
}

.payroll-weekly-head {
  color: var(--green);
  background: #eef7f4;
  font-weight: 700;
}

.payroll-deduction-check {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  font-size: 13px;
}

.payroll-grand-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.payroll-grand-totals span,
.welfare-store-grid span,
.monthly-worker-counts span {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.payroll-grand-totals small,
.welfare-store-grid small,
.monthly-worker-counts small {
  color: var(--muted);
}

.payroll-summary-table {
  min-width: 850px;
}

.welfare-report-panel #loadWelfareReportButton,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.button-link.ghost {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.welfare-report-panel {
  margin-top: 18px;
  min-width: 0;
  max-width: 100%;
}

.welfare-report-empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.welfare-store-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.welfare-store-grid span,
.welfare-store-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.welfare-missing-fields {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f0d18a;
  border-radius: 8px;
  color: #725016;
  background: #fffaf0;
  font-size: 13px;
}

.welfare-form-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 2px solid #dce9e5;
  min-width: 0;
  max-width: 100%;
}

.welfare-form-block h3,
.welfare-form-block p {
  margin: 0;
}

.welfare-table {
  min-width: 1080px;
  table-layout: fixed;
  font-size: 12px;
}

.welfare-table th,
.welfare-table td {
  padding: 7px 5px;
  border-right: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.welfare-form-block > .table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.welfare-table thead th,
.welfare-table tfoot th,
.welfare-table tfoot td {
  background: #f1f6f4;
}

.monthly-worker-counts {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.payslip-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.payslip-totals span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--muted);
  font-size: 13px;
}

.payslip-detail-table {
  display: grid;
  gap: 0;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.payslip-detail-head,
.payslip-detail-row {
  display: grid;
  grid-template-columns: 110px minmax(180px, 1fr) 90px 110px;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.payslip-detail-head {
  background: #eef7f4;
  color: var(--green);
  font-weight: 700;
}

.payslip-detail-row:last-child {
  border-bottom: 0;
}

.payslip-verify {
  border: 1px solid #cfe2dc;
  border-radius: 8px;
  background: #fbfefd;
  padding: 10px 12px;
}

.payslip-verify summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 700;
}

.verify-block {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.verify-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.verify-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(90px, 0.7fr) minmax(90px, 0.8fr) minmax(130px, 1fr) minmax(90px, 0.8fr);
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  align-items: center;
}

.verify-row:last-child {
  border-bottom: 0;
}

.verify-row.single {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.verify-head {
  background: #eef7f4;
  color: var(--green);
  font-weight: 700;
}

.ok-text {
  color: #0f7a5f;
  font-weight: 700;
}

.warn-text {
  color: #b42318;
  font-weight: 700;
}

.manual-text {
  color: var(--muted);
  font-weight: 700;
}

.contract-template-box {
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 16px;
  overflow: hidden;
}

.contract-template-form {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 0;
}

.contract-template-form > .form-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.template-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.template-toolbar .small-button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.template-toolbar #templateSendSignatureButton {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.contract-attachment-options {
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.contract-attachment-options > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.contract-attachment-options strong {
  font-size: 14px;
}

.contract-attachment-options span {
  color: var(--muted);
  font-size: 13px;
}

.attachment-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 8px;
}

.attachment-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.attachment-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.attachment-delete-button {
  min-width: 52px;
  padding: 0 9px;
  border: 1px solid #ffd6c2;
  border-radius: 8px;
  background: #fff7f2;
  color: #bb4a1f;
  cursor: pointer;
}

.attachment-delete-button:hover,
.attachment-delete-button:focus {
  border-color: #f0a884;
  background: #ffefe6;
}

.attachment-option input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}

.attachment-checkmark {
  display: inline-grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid #b7c5cf;
  border-radius: 5px;
  background: #fff;
}

.attachment-checkmark::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg);
}

.attachment-option:has(input:checked) {
  border-color: var(--accent);
  background: #eef8f5;
  color: var(--accent-dark);
}

.attachment-option:has(input:checked) .attachment-checkmark {
  border-color: var(--accent);
  background: var(--accent);
}

.attachment-option:has(input:checked) .attachment-checkmark::after {
  border-color: #fff;
}

.contract-document-preview {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: 100%;
  padding: 18px 12px 84px;
  border-radius: 8px;
  background: #e8edf0;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  max-height: min(68vh, 760px);
}

.contract-paper {
  box-sizing: border-box;
  --paper-scale: 1;
  width: 210mm;
  max-width: 100%;
  height: 297mm;
  min-height: 0;
  margin: 0 auto;
  padding: 16mm 13mm;
  border: 1px solid #cfd6dd;
  border-radius: 2px;
  background: #fff;
  color: #111;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  font-family: "Malgun Gothic", "맑은 고딕", Arial, sans-serif;
}

.contract-paper.paper-overflowing {
  height: auto;
  min-height: 297mm;
  overflow: visible;
}

.contract-paper-title {
  margin: 0 0 8px;
  color: #111;
  font-size: calc(24px * var(--paper-scale));
  font-weight: 500;
  letter-spacing: 0;
  text-align: center;
}

.contract-identity-table {
  display: grid;
  grid-template-columns: minmax(0, 13%) minmax(0, 14%) minmax(0, 35%) minmax(0, 14%) minmax(0, 24%);
  width: 100%;
  max-width: 100%;
  margin: 0 0 34px;
  border: 2px solid #111;
  border-right: 0;
  border-bottom: 0;
  font-size: calc(12px * var(--paper-scale));
}

.identity-cell {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: calc(34px * var(--paper-scale));
  box-sizing: border-box;
  padding: calc(5px * var(--paper-scale)) calc(7px * var(--paper-scale));
  border-right: 1px solid #777;
  border-bottom: 1px solid #777;
  color: #111;
  line-height: 1.28;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.identity-head {
  justify-content: center;
  font-weight: 700;
  text-align: center;
}

.identity-party {
  line-height: 1.55;
}

.identity-value {
  justify-content: flex-start;
  font-weight: 600;
}

.identity-rowspan-2 {
  grid-row: span 2;
}

.identity-colspan-3 {
  grid-column: span 3;
}

.contract-paper-section {
  display: block;
  padding: 0;
  border: 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.contract-paper-section h4 {
  margin: 0 0 2px;
  color: #111;
  font-size: calc(12.5px * var(--paper-scale));
  font-weight: 700;
  line-height: 1.35;
}

.contract-paper-section div {
  margin: 0 0 9px 17px;
  color: #111;
  font-size: calc(12.2px * var(--paper-scale));
  line-height: 1.32;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.contract-line {
  display: block;
  margin: 0 0 1px;
  word-break: keep-all;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.contract-line.manual-indent {
  margin-left: var(--manual-indent);
}

.contract-line.has-marker {
  display: grid;
  grid-template-columns: var(--marker-width) minmax(0, 1fr);
  align-items: start;
  padding-left: 0;
  text-indent: 0;
}

.line-marker {
  white-space: pre;
}

.line-body {
  min-width: 0;
}

.contract-line.blank {
  height: calc(7px * var(--paper-scale));
}

.number-line {
  padding-left: 1.65em;
  text-indent: -1.65em;
}

.sub-number-line {
  padding-left: 2.25em;
  text-indent: -2.25em;
}

.circled-number-line {
  padding-left: 1.45em;
  text-indent: -1.45em;
}

.korean-alpha-line {
  padding-left: 1.6em;
  text-indent: -1.6em;
}

.dash-line {
  padding-left: 0.95em;
  text-indent: -0.95em;
}

.note-line {
  padding-left: 1.15em;
  text-indent: -1.15em;
}

.article-line {
  margin-top: 8px;
  font-weight: 700;
}

.signer-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: min(320px, 100%);
  margin: 10px 0 18px;
  margin-left: auto;
}

.confirm-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  text-align: right;
  margin-top: 14px;
  margin-bottom: 2px !important;
  padding-left: 0;
  text-indent: 0;
}

.confirm-signature {
  display: inline-flex;
  flex: 0 0 auto;
}

.contract-final-section {
  text-align: center;
}

.contract-final-section .contract-line {
  text-align: center;
  padding-left: 0;
  text-indent: 0;
}

.contract-final-section .signer-line,
.contract-final-section .confirm-line {
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.confirmation-lines .signer-line,
.goods-lines .signer-line {
  margin-top: 2px;
  margin-bottom: 24px;
}

.document-page {
  color: #111;
  font-size: calc(13px * var(--paper-scale));
  line-height: 1.58;
}

.document-rules {
  padding-top: calc(8mm * var(--paper-scale));
}

.document-title {
  margin: 0 0 18px;
  font-size: calc(28px * var(--paper-scale));
  font-weight: 800;
  text-align: center;
}

.spaced-title {
  letter-spacing: 12px;
}

.document-lines .contract-line {
  margin-bottom: 4px;
}

.minor-education-table {
  display: grid;
  grid-template-columns: 12% 23% 12% 22% 12% 19%;
  border: 1.5px solid #333;
  border-right: 0;
  border-bottom: 0;
  font-size: calc(13px * var(--paper-scale));
}

.minor-education-table > div {
  min-height: calc(34px * var(--paper-scale));
  padding: calc(7px * var(--paper-scale)) calc(8px * var(--paper-scale));
  border-right: 1px solid #777;
  border-bottom: 1px solid #777;
  display: flex;
  align-items: center;
  justify-content: center;
}

.minor-title {
  grid-column: 1 / -1;
  min-height: calc(56px * var(--paper-scale)) !important;
  font-size: calc(28px * var(--paper-scale));
  font-weight: 700;
  letter-spacing: 6px;
}

.minor-label {
  font-weight: 700;
  background: #fafafa;
}

.minor-education-table .span-5 {
  grid-column: span 5;
  justify-content: flex-start;
}

.minor-education-table .span-2 {
  grid-column: span 2;
  justify-content: flex-start;
}

.minor-education-table .strong {
  font-size: calc(18px * var(--paper-scale));
  font-weight: 700;
}

.minor-content {
  margin-top: 28px;
  font-size: calc(12.3px * var(--paper-scale));
  line-height: 1.5;
}

.minor-content .contract-line {
  margin-bottom: 2px;
}

.attendance-title {
  margin: 18px 0 6px;
  font-size: calc(24px * var(--paper-scale));
  text-align: center;
  letter-spacing: 3px;
}

.attendance-grid {
  display: grid;
  grid-template-columns: 14% 16% 20% 14% 16% 20%;
  border: 1px solid #555;
  border-right: 0;
  border-bottom: 0;
  font-size: calc(13px * var(--paper-scale));
}

.attendance-grid > div {
  min-width: 0;
  min-height: calc(34px * var(--paper-scale));
  padding: calc(5px * var(--paper-scale));
  border-right: 1px solid #777;
  border-bottom: 1px solid #777;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.confirmation-page,
.goods-page {
  padding: 22mm 8mm 0;
}

.confirmation-page + *,
.goods-page + * {
  margin-top: 0;
}

.confirmation-lines,
.goods-lines {
  font-size: calc(14px * var(--paper-scale));
  line-height: 1.9;
}

.confirmation-lines .contract-line,
.goods-lines .contract-line {
  margin-bottom: 10px;
}

.business-breach-special-page {
  padding: 7mm 2mm 0;
}

.business-breach-special-page .document-title {
  margin-bottom: 26px;
  font-size: calc(22px * var(--paper-scale));
  letter-spacing: 2px;
}

.business-breach-special-lines {
  font-size: calc(12.5px * var(--paper-scale));
  line-height: 1.55;
}

.business-breach-special-lines .contract-line {
  margin-bottom: 3px;
}

.business-breach-special-lines .contract-line.blank {
  height: calc(8px * var(--paper-scale));
}

.business-breach-special-lines .signer-line {
  margin-top: 5px;
  margin-bottom: 9px;
}

.business-breach-date {
  margin: 18px 0 14px;
  font-size: calc(16px * var(--paper-scale));
  text-align: center;
}

.business-breach-signature-grid {
  display: grid;
  grid-template-columns: 16% 17% 17% 16% 17% 17%;
  border: 1px solid #444;
  border-right: 0;
  border-bottom: 0;
  font-size: calc(12px * var(--paper-scale));
}

.business-breach-signature-grid > div {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  min-width: 0;
  min-height: calc(38px * var(--paper-scale));
  padding: calc(4px * var(--paper-scale));
  border-right: 1px solid #666;
  border-bottom: 1px solid #666;
  text-align: center;
  overflow: hidden;
}

.business-breach-signature-grid > div:nth-child(-n + 6) {
  background: #f5f5f5;
  font-weight: 700;
}

.attendance-grid .esign-line,
.business-breach-signature-grid .esign-line {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: calc(24px * var(--paper-scale));
  padding: calc(1px * var(--paper-scale)) calc(3px * var(--paper-scale));
  gap: 0;
  overflow: hidden;
}

.attendance-grid .esign-line.signed,
.business-breach-signature-grid .esign-line.signed {
  min-width: 0;
}

.attendance-grid .esign-line.signed img,
.business-breach-signature-grid .esign-line.signed img {
  width: 100%;
  max-width: 100%;
  max-height: calc(22px * var(--paper-scale));
}

.attendance-grid .esign-line.signed span,
.business-breach-signature-grid .esign-line.signed span {
  display: none;
}

.esign-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  place-items: center;
  min-width: 50px;
  min-height: 20px;
  margin-left: 4px;
  padding: 1px 6px;
  border: 1px dashed #2f6f9f;
  border-radius: 2px;
  background: #f5fbff;
  color: #235d86;
  font-size: 11px;
  line-height: 1.2;
  vertical-align: baseline;
}

body.sign-page [data-sign-target] {
  cursor: pointer;
}

body.sign-page [data-sign-target]:focus {
  outline: 3px solid rgba(22, 120, 97, 0.35);
  outline-offset: 2px;
}

.esign-box.signed {
  min-width: 78px;
  border-style: solid;
  border-color: #7ab99e;
  background: #f2fbf6;
  color: #17654d;
}

.esign-box img,
.esign-line img {
  display: block;
  max-width: 72px;
  max-height: 24px;
  object-fit: contain;
}

.esign-box.signed span,
.esign-line.signed span {
  font-size: 9px;
  white-space: nowrap;
}

.contract-final-block {
  margin-top: 16px;
  text-align: center;
}

.contract-final-block p {
  margin: 0 0 10px;
}

.contract-date-line {
  margin-top: 24px !important;
  letter-spacing: 0;
}

.contract-final-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  width: min(560px, 100%);
  margin: 16px auto 0;
}

.contract-final-signatures > div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.esign-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 86px;
  min-height: 26px;
  padding: 2px 8px;
  border: 1px dashed #2f6f9f;
  border-radius: 2px;
  background: #f5fbff;
  color: #235d86;
  font-size: 11px;
  line-height: 1.4;
}

.esign-line.signed {
  min-width: 112px;
  border-style: solid;
  border-color: #7ab99e;
  background: #f2fbf6;
  color: #17654d;
}

.esign-line.signed img {
  max-width: 88px;
  max-height: 28px;
}

#contractTemplateSections {
  display: grid;
  gap: 8px;
  max-height: min(68vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

#contractTemplateSections.hidden,
#contractTemplatePreview.hidden {
  display: none !important;
}

@page {
  size: A4;
  margin: 0;
}

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

  body:not(.sign-page) > *:not(.modal),
  .toast,
  .modal:not(#contractTemplateModal),
  #contractTemplateModal .item-header,
  #contractTemplateModal .template-toolbar,
  #contractTemplateModal .contract-attachment-options,
  #contractTemplateModal .form-actions,
  #contractTemplateSections {
    display: none !important;
  }

  #contractTemplateModal {
    position: static;
    display: block !important;
    padding: 0;
    background: #fff;
  }

  #contractTemplateModal .contract-template-box,
  #contractTemplateForm,
  #contractTemplatePreview {
    display: block;
    width: auto;
    max-width: none;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    overflow: visible;
  }

  .contract-paper {
    width: 210mm;
    height: 297mm;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 16mm 13mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .contract-paper.paper-overflowing {
    height: auto;
    min-height: 297mm;
    overflow: visible;
  }

  .contract-paper:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}

.template-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.template-section-button {
  position: relative;
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.template-section-button:hover,
.template-section-button:focus {
  border-color: var(--primary);
  background: #f3faf8;
  outline: none;
}

.template-section-button span {
  font-weight: 700;
}

.template-section-button em {
  position: absolute;
  right: 12px;
  top: 10px;
  max-width: min(280px, calc(100% - 24px));
  padding: 5px 8px;
  border: 1px solid #b9d8cf;
  border-radius: 6px;
  background: #0f3f36;
  color: #fff;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 2;
}

.template-section-button:hover em,
.template-section-button:focus em {
  opacity: 1;
  transform: translateY(0);
}

.template-section-button small {
  color: var(--muted);
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.template-section-row {
  display: grid;
  gap: 6px;
}

.template-section-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.template-required-badge {
  align-self: center;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #b9d8cf;
  border-radius: 8px;
  background: #eef8f5;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.template-insert-button {
  justify-self: start;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px dashed #9abfb5;
  border-radius: 999px;
  background: #f7fbfa;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
}

.template-insert-button:hover,
.template-insert-button:focus {
  border-color: var(--primary);
  background: #e9f5f1;
  outline: none;
}

.template-insert-bottom {
  margin-top: 2px;
}

.template-delete-button {
  align-self: stretch;
  min-width: 64px;
  padding: 0 12px;
  border: 1px solid #ffd1c2;
  border-radius: 8px;
  background: #fff4ed;
  color: var(--warn);
  font-size: 13px;
  cursor: pointer;
}

.template-delete-button:hover,
.template-delete-button:focus {
  border-color: var(--warn);
  background: #ffe9dc;
  outline: none;
}

.template-section-modal-box {
  width: min(760px, calc(100vw - 32px));
}

.template-section-editor {
  display: grid;
  gap: 12px;
}

.template-section-editor textarea {
  min-height: 360px;
  line-height: 1.55;
  resize: vertical;
}

.template-section textarea {
  min-height: 150px;
  line-height: 1.55;
}

.signed-template-section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.signed-template-section div {
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  .contract-tab-heading,
  .worker-tab-heading,
  .store-tab-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .contract-tab-heading > button,
  .store-tab-heading > button,
  .worker-tab-heading-actions,
  .worker-tab-heading-actions > button { width: 100%; }

  .worker-tab-heading-actions { flex-direction: column; }

  .worker-contract-inline {
    align-items: stretch;
    flex-direction: column;
  }

  .worker-contract-actions {
    justify-content: flex-start;
  }

  .store-card .item-header {
    align-items: stretch;
    flex-direction: column;
  }

  .store-card .actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .store-card .actions > button {
    white-space: nowrap;
  }

  #contractForm.contract-editor-form { grid-template-columns: 1fr; }

  .summary {
    grid-template-columns: repeat(2, 1fr);
    min-width: 0;
    margin-top: 18px;
  }

  .account-panel {
    margin-top: 16px;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  #ownerLabel,
  #currentStoreLabel {
    justify-content: flex-start;
  }

  .grid-form,
  .inline-form,
  #storeForm.store-editor-form,
  .worker-form,
  .payroll-form,
  .contract-subgrid,
  #weekdayPattern,
  #shiftWeekdayPattern {
    grid-template-columns: 1fr;
  }

  .payroll-form-actions {
    justify-content: flex-start;
  }

  .payroll-grand-totals,
  .welfare-store-grid,
  .monthly-worker-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payroll-weekly-row {
    min-width: 720px;
  }

  .weekly-decision-row {
    grid-template-columns: 1fr 1fr;
  }

  .weekly-decision-info {
    grid-column: 1 / -1;
  }

  .weekly-decision-row button {
    width: 100%;
  }

  .schedule-toolbar {
    grid-template-columns: 1fr 160px;
  }

  .schedule-toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .payroll-dashboard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .payroll-toolbar {
    justify-content: flex-start;
  }

  .payroll-employee-row {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(105px, auto)) 85px;
  }

  .payroll-quick-metric:nth-of-type(2) {
    display: none;
  }

  .form-spacer {
    display: none;
  }

  .invisible-field {
    display: none;
  }

  .schedule-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .contract-card .item-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .contract-card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .contract-change-meta {
    grid-template-columns: 1fr;
  }

  .contract-change-meta .contract-change-reason,
  .contract-change-meta > p {
    grid-column: auto;
  }

  .schedule-calendar {
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    overflow-x: auto;
  }

  .assignment-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .assignment-grid {
    grid-template-columns: minmax(150px, 1.2fr) repeat(7, minmax(120px, 1fr));
  }

  .wide,
  fieldset.wide,
  .bank-account-group {
    grid-column: auto;
  }

  .bank-account-group {
    grid-template-columns: 1fr;
  }

  .retirement-group {
    grid-template-columns: 1fr;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .contract-document-preview {
    padding: 8px;
  }

  .contract-paper {
    height: 297mm;
    min-height: 0;
    padding: 18mm 9mm;
  }

  .contract-paper-title {
    font-size: 22px;
  }

  .contract-identity-table {
    margin-bottom: 34px;
    font-size: 10.5px;
  }

  .identity-cell {
    min-height: 32px;
    padding: 5px 4px;
  }

  .contract-paper-section h4,
  .contract-paper-section div {
    font-size: 12px;
  }

  .attachment-checks {
    grid-template-columns: 1fr;
  }

  .contract-final-signatures {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .signature-send-actions {
    grid-template-columns: 1fr;
  }

  .counter-shell {
    padding: 14px;
  }

  .counter-header,
  .counter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .counter-grid,
  .counter-backup-form,
  .worker-summary {
    grid-template-columns: 1fr;
  }

  .worker-month-label {
    align-items: stretch;
    flex-direction: column;
  }

  .worker-record {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .worker-record-status {
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .contract-worker-actions { grid-template-columns: 1fr; }
  .contract-worker-action { grid-template-columns: 1fr; }
  .contract-worker-action button { width: 100%; white-space: normal; }

  .schedule-toolbar {
    grid-template-columns: 1fr;
  }

  .schedule-toolbar-actions {
    grid-column: auto;
  }

  .schedule-toolbar-actions button {
    flex: 1 1 auto;
  }

  .view-toggle.schedule-view-toggle {
    grid-template-columns: repeat(2, 1fr);
  }

  .payroll-toolbar,
  .payroll-toolbar > label {
    width: 100%;
  }

  .payroll-toolbar > button,
  .payroll-manual-details,
  .payroll-manual-details > summary {
    width: 100%;
  }

  .payroll-manual-fields {
    position: static;
    grid-template-columns: 1fr;
    width: 100%;
    margin-top: 7px;
    box-shadow: none;
  }

  .payroll-grand-totals {
    grid-template-columns: repeat(2, 1fr);
  }

  .payroll-grand-totals span:last-child {
    grid-column: 1 / -1;
  }

  .payroll-employee-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .payroll-employee-identity {
    grid-column: 1 / -1;
  }

  .payroll-quick-metric {
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
  }

  .payroll-quick-metric:nth-of-type(2) {
    display: grid;
  }

  .payroll-row-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .payroll-card-details > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .payroll-card-details > summary small {
    margin-left: 0;
  }
}
/* Public live-demo banner */
.demo-notice {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 48px;
  padding: 9px 18px;
  border-bottom: 1px solid #efc66e;
  background: #fff7df;
  color: #563b05;
  box-shadow: 0 6px 20px rgba(72, 49, 2, 0.12);
}

.demo-notice strong { color: #0e6957; }
.demo-notice span { line-height: 1.45; }
.demo-notice b { color: #b05018; }
.demo-notice a {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 9px;
  background: #176f5e;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

body.demo-mode #passwordButton,
body.demo-mode #logoutButton,
body.demo-mode #restoreDatabaseButton { display: none; }

@media (max-width: 720px) {
  .demo-notice {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: stretch;
    gap: 4px 10px;
    padding: 8px 12px;
  }
  .demo-notice strong { min-width: 0; white-space: nowrap; }
  .demo-notice span { grid-column: 1 / -1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
  .demo-notice a { margin: 0; white-space: nowrap; }
}
