:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --surface: #fffdfa;
  --field-person: #eef4ed;
  --field-apprentice: #f4efe3;
  --field-general: #edf2f6;
  --line: #ddd6cc;
  --line-strong: #bdb3a7;
  --text: #272521;
  --muted: #746f66;
  --green: #92c9a3;
  --green-soft: #e1f3e7;
  --blue: #d8e8f6;
  --shadow: 0 14px 38px rgb(73 64 50 / 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

a {
  color: inherit;
}

.staff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 5vw, 62px) 14px;
}

.app-kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.staff-header h1,
.app-header h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0;
}

.admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid #9bb0c0;
  border-radius: 9px;
  padding: 7px 13px;
  background: var(--blue);
  color: #233848;
  font-size: 0.9rem;
  text-decoration: none;
}

.admin-button.neutral {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.staff-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 12px auto 46px;
}

.stacked-fields {
  display: grid;
  gap: 18px;
}

.task-field {
  display: grid;
  gap: 16px;
  min-height: 238px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 26px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.task-field.person1 {
  background: var(--field-person);
}

.task-field.apprentices {
  background: var(--field-apprentice);
}

.task-field.general {
  background: var(--field-general);
}

.task-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-field h2 {
  margin: 0;
  font-size: clamp(1.08rem, 2vw, 1.42rem);
  letter-spacing: 0;
}

.task-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgb(0 0 0 / 0.08);
  border-radius: 999px;
  padding: 4px 11px;
  background: rgb(255 255 255 / 0.48);
  color: var(--muted);
  font-size: 0.84rem;
}

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

.task-line {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  border: 1px solid rgb(120 112 101 / 0.22);
  border-radius: 13px;
  padding: 8px 10px;
  background: rgb(255 255 255 / 0.7);
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.task-line.just-completed {
  border-color: #78b98c;
  background: var(--green-soft);
  transform: translateY(-1px);
}

.task-line.is-done {
  background: rgb(255 255 255 / 0.45);
}

.task-check-button,
.task-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fffefa;
  color: var(--text);
  font-weight: 700;
  line-height: 1;
}

.task-check-button {
  color: transparent;
}

.task-check-button::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid #aaa095;
  border-radius: 4px;
  background: transparent;
}

.task-check-button:hover::before {
  border-color: #6fa680;
}

.task-line.just-completed .task-check-button,
.task-line.is-done .task-check-button {
  border-color: #6fa680;
  background: var(--green);
  color: #17391f;
}

.task-line.just-completed .task-check-button::before,
.task-line.is-done .task-check-button::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  border: 0;
  color: #17391f;
  font-size: 1rem;
}

.task-title {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.task-line.is-done .task-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.task-info-button {
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.done-section {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid rgb(120 112 101 / 0.16);
}

.done-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.empty-state {
  margin: 0;
  border: 1px dashed rgb(120 112 101 / 0.28);
  border-radius: 13px;
  padding: 14px;
  background: rgb(255 255 255 / 0.38);
  color: var(--muted);
  font-size: 0.93rem;
  text-align: center;
}

.system-state {
  min-height: 20px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: right;
}

.task-dialog {
  width: min(560px, calc(100% - 28px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.small-dialog {
  width: min(420px, calc(100% - 28px));
}

.task-dialog::backdrop {
  background: rgb(39 37 33 / 0.24);
}

.task-dialog form {
  display: grid;
  gap: 16px;
  padding: 21px;
}

.task-dialog header,
.task-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-dialog header h2 {
  margin: 0;
  font-size: 1.08rem;
}

.task-dialog header button {
  width: 32px;
  min-height: 32px;
  padding: 0;
}

.task-dialog dl {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 8px 12px;
  margin: 0;
  font-size: 0.92rem;
}

.task-dialog dt {
  color: var(--muted);
}

.task-dialog dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.task-dialog label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.task-dialog select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fffefa;
  color: var(--text);
}

.task-dialog button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 6px 12px;
  background: #fffefa;
  color: var(--text);
}

.task-dialog footer button:last-child {
  border-color: #6fa680;
  background: var(--green-soft);
  color: #17391f;
}

.pdf-open-button {
  min-height: 30px !important;
  border-color: #9bb0c0 !important;
  background: var(--blue) !important;
  color: #233848 !important;
  text-align: left;
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: #9f3434;
  font-size: 0.86rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 5vw, 42px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.app-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-header nav a {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 6px 10px;
  color: var(--text);
  text-decoration: none;
}

.page-shell {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto;
}

.intro-panel,
.placeholder-list article,
.login-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-panel h2,
.placeholder-list h2,
.placeholder-list h3,
.login-panel h2 {
  margin: 0 0 8px;
}

.intro-panel p,
.placeholder-list p,
.login-panel p {
  margin: 0;
  color: var(--muted);
}

.placeholder-list {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.login-canvas {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 78px);
  padding: 24px;
}

.login-panel {
  width: min(360px, 100%);
}

.login-panel form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.login-panel input {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 10px;
}

.login-panel button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--blue);
}

.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #a22520 !important;
  font-size: 0.88rem;
}

.admin-page {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  background: #f0ece4;
}

.admin-sidebar h1 {
  margin: 0;
  font-size: 1.45rem;
}

.admin-sidebar nav {
  display: grid;
  gap: 9px;
}

.admin-nav-button,
.admin-back-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 12px;
  background: transparent;
  color: var(--text);
  font-size: 0.94rem;
  text-align: left;
  text-decoration: none;
}

.admin-nav-button.is-active {
  border-color: var(--line);
  background: rgb(255 255 255 / 0.62);
  box-shadow: 0 8px 24px rgb(73 64 50 / 0.06);
}

.admin-back-link {
  margin-top: auto;
  border-color: var(--line);
  background: rgb(255 255 255 / 0.45);
}

.logout-button {
  border-color: #d69a90;
  background: #fff5f2;
  color: #8f1813;
}

.auth-warning {
  margin: 0;
  border: 1px solid #d6b56f;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff8df;
  color: #725111;
  font-size: 0.86rem;
  line-height: 1.35;
}

.admin-main {
  padding: 28px clamp(18px, 4vw, 48px);
}

.admin-panel {
  display: none;
}

.admin-panel.is-active {
  display: grid;
  gap: 18px;
}

.admin-panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.admin-panel h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

.admin-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.password-form {
  grid-template-columns: repeat(3, minmax(170px, 1fr)) auto;
}

.backup-form {
  grid-template-columns: auto minmax(220px, 1fr);
}

.backup-import-field {
  min-width: 0;
}

.admin-form label,
.month-filter {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.month-filter input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fffefa;
  color: var(--text);
  font-weight: 400;
}

.admin-form textarea {
  resize: vertical;
}

.admin-form input[type="file"] {
  padding: 7px 10px;
}

.admin-form button {
  min-height: 40px;
  border: 1px solid #6fa680;
  border-radius: 10px;
  padding: 8px 14px;
  background: var(--green-soft);
  color: #17391f;
}

.field-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.task-template-form .admin-form-actions {
  grid-column: span 2;
}

.admin-form-actions button:last-child {
  border-color: var(--line-strong);
  background: #fffefa;
  color: var(--text);
}

.admin-form .wide-field {
  grid-column: span 2;
}

.group-name-form {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.group-name-form .wide-field {
  grid-column: auto;
}

.admin-checkbox {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fffefa;
  color: var(--text) !important;
  font-weight: 400 !important;
}

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

.time-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}

.time-field {
  min-width: 0;
}

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

.admin-list-item {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  background: rgb(255 255 255 / 0.66);
}

.admin-list-item strong {
  overflow-wrap: anywhere;
}

.admin-list-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-action-item {
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
}

.task-template-item {
  grid-template-columns: minmax(0, 1fr) auto 42px;
  align-items: center;
  gap: 12px;
}

.admin-list-item-content {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.edit-template-button,
.delete-template-button,
.delete-employee-button {
  justify-self: end;
  height: 40px;
  border: 1px solid #d69a90;
  border-radius: 10px;
  background: #fff5f2;
  color: #c92821;
  font-size: 1.4rem;
  line-height: 1;
}

.delete-template-button,
.delete-employee-button {
  width: 40px;
}

.edit-template-button {
  width: auto;
  min-width: 92px;
  border-color: #9bb0c0;
  background: var(--blue);
  color: #233848;
  font-size: 0.86rem;
}

.edit-template-button:hover {
  border-color: #6d879a;
  background: #cfe0ef;
}

.delete-template-button:hover,
.delete-employee-button:hover {
  border-color: #c92821;
  background: #ffe5df;
}

.delete-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.delete-confirm-button {
  border-color: #c92821 !important;
  background: #ffe5df !important;
  color: #8f1813 !important;
}

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

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

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

.report-table th {
  background: #f5f0e8;
  color: var(--muted);
  font-size: 0.84rem;
}

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

@media (max-width: 720px) {
  .staff-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 20px;
  }

  .staff-shell {
    width: min(100% - 22px, 1080px);
    margin-top: 8px;
  }

  .task-field {
    min-height: 210px;
    padding: 15px;
  }

  .task-line {
    grid-template-columns: 40px minmax(0, 1fr) 36px;
    gap: 9px;
  }

  .task-dialog dl {
    grid-template-columns: 1fr;
  }

  .admin-page {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px;
  }

  .admin-sidebar nav {
    grid-template-columns: 1fr;
  }

  .admin-back-link {
    margin-top: 0;
  }

  .admin-main {
    padding: 18px 12px 28px;
  }

  .admin-panel-header,
  .admin-form {
    grid-template-columns: 1fr;
  }

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

  .task-template-form {
    grid-template-columns: 1fr;
  }

  .admin-form .wide-field {
    grid-column: auto;
  }

  .task-template-form .admin-form-actions {
    grid-column: auto;
  }

  .task-template-item {
    grid-template-columns: 1fr;
  }

  .task-template-item .edit-template-button,
  .task-template-item .delete-template-button {
    justify-self: start;
  }
}
