* {
  box-sizing: border-box;
}

:root {
  --bg: #d8d1c4;
  --paper: #f7f1e3;
  --paper-line: #c7ddff;
  --paper-red: rgba(223, 86, 86, 0.55);
  --text: #1f2430;
  --muted: #6e7380;
  --border: #d7d7d7;
  --white: #ffffff;
  --dark: #1f2430;
  --dark-2: #2a3142;
  --danger: #c94141;
  --danger-dark: #aa3131;
  --soft: #ece7db;
  --shadow: 0 18px 40px rgba(31, 36, 48, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #ddd7ca 0%, #d2cabd 100%);
}

body {
  min-height: 100vh;
}

a {
  color: #4f46e5;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page-shell {
  width: 100%;
  padding: 32px 18px 46px;
}

.top-bar {
  max-width: 980px;
  margin: 0 auto 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.paper {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  background:
    repeating-linear-gradient(
      to bottom,
      var(--paper) 0,
      var(--paper) 34px,
      var(--paper-line) 35px
    );
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 34px 34px 40px 78px;
  overflow: hidden;
  min-height: 680px;
}

.paper::before {
  content: "";
  position: absolute;
  left: 48px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--paper-red);
}

.paper-tear {
  position: absolute;
  inset: 0 0 auto 0;
  height: 18px;
  background:
    radial-gradient(circle at 10px 18px, transparent 11px, var(--paper) 12px) repeat-x;
  background-size: 26px 18px;
  opacity: 0.95;
}

.paper-header {
  text-align: center;
  margin: 8px 0 30px;
}

.paper-header h1 {
  margin: 0;
  font-size: 3rem;
  line-height: 1.05;
  letter-spacing: 1.5px;
  font-weight: 800;
  color: #1d2330;
}

.admin-link,
.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--dark);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(31, 36, 48, 0.12);
  transition: transform 0.15s ease, background 0.15s ease;
}

.admin-link:hover,
.top-link:hover {
  background: var(--dark-2);
  text-decoration: none;
  transform: translateY(-1px);
}

.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

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

.controls {
  margin-bottom: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(240px, 380px);
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label {
  font-size: 1.02rem;
  font-weight: 800;
  color: #1f2430;
}

.field-group input,
.field-group select,
.input-inline {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(31, 36, 48, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px 14px;
  font-size: 1.02rem;
  color: var(--text);
  outline: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.field-group input::placeholder,
.input-inline::placeholder {
  color: #979cab;
}

.field-group input:focus,
.field-group select:focus,
.input-inline:focus {
  border-color: #7a90c4;
  box-shadow: 0 0 0 4px rgba(122, 144, 196, 0.12);
}

.button-row,
.inline-form-row {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.small-btn,
.small-danger-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 0.1px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 46px;
  padding: 0 18px;
  font-size: 1rem;
}

.primary-btn {
  background: var(--dark);
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 36, 48, 0.12);
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: var(--dark-2);
}

.secondary-btn {
  background: #ddd9d0;
  color: var(--text);
}

.secondary-btn:hover {
  transform: translateY(-1px);
  background: #d2cdbf;
}

.danger-btn {
  background: var(--danger);
  color: #fff;
}

.danger-btn:hover {
  transform: translateY(-1px);
  background: var(--danger-dark);
}

.small-btn,
.small-danger-btn {
  min-height: 34px;
  min-width: 34px;
  padding: 0 10px;
  font-size: 0.95rem;
}

.small-btn {
  background: #e1ddd3;
  color: var(--text);
}

.small-btn:hover {
  background: #d4cebf;
}

.small-danger-btn {
  background: var(--danger);
  color: #fff;
}

.small-danger-btn:hover {
  background: var(--danger-dark);
}

.print-meta {
  display: none;
  margin: 8px 0 18px;
  font-size: 1rem;
  line-height: 1.7;
}

.empty-state {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(31, 36, 48, 0.08);
  font-size: 1.05rem;
}

.checklist {
  margin-top: 18px;
}

.checklist-row {
  min-height: 35px;
  display: flex;
  align-items: center;
}

.checkline {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  column-gap: 12px;
  cursor: pointer;
  min-height: 35px;
}

.item-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid #4a4f5a;
  background: #fff;
  border-radius: 3px;
  position: relative;
  align-self: center;
  margin-top: 0;
}

.item-checkbox:checked + .checkbox-custom::after {
  content: "✓";
  position: absolute;
  left: 2px;
  top: -4px;
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
  color: #1e2430;
}

.item-label {
  font-size: 1.05rem;
  line-height: 1.25;
  align-self: center;
  padding-right: 10px;
}

.item-label.done {
  text-decoration: line-through;
  opacity: 0.6;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 22px 40px rgba(18, 22, 30, 0.22);
}

.modal-card h3 {
  margin: 0 0 10px;
  font-size: 1.4rem;
}

.modal-card p {
  margin: 0;
  color: #505562;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

/* ADMIN */
.admin-sections {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.admin-card {
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(31, 36, 48, 0.08);
  border-radius: 16px;
  padding: 18px 18px 16px;
  backdrop-filter: blur(2px);
}

.admin-card h2 {
  margin: 0 0 14px;
  font-size: 1.8rem;
  line-height: 1.1;
}

.admin-card h3 {
  margin: 0 0 14px;
  font-size: 1.3rem;
}

.admin-form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-form-row .input-inline,
.admin-form-row select {
  flex: 1 1 260px;
  max-width: 460px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(31, 36, 48, 0.07);
}

.admin-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.admin-item-order {
  flex: 0 0 auto;
  font-weight: 800;
  color: #5b6270;
  min-width: 24px;
}

.admin-item-label {
  font-size: 1.02rem;
  line-height: 1.35;
  word-break: break-word;
}

.admin-item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
}

.notice.success {
  background: #dff3df;
  color: #285d28;
  border: 1px solid #bddfbd;
}

.notice.error {
  background: #f9dddd;
  color: #8a2e2e;
  border: 1px solid #efbcbc;
}

/* LOGIN */
.login-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.login-card {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(31, 36, 48, 0.08);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 24px rgba(31, 36, 48, 0.06);
}

.login-card h2 {
  margin: 0 0 16px;
  font-size: 2rem;
}

.login-card p {
  color: var(--muted);
}

/* PRINT */
@media print {
  html,
  body {
    background: #fff;
  }

  .page-shell {
    padding: 0;
  }

  .paper {
    max-width: none;
    margin: 0;
    min-height: auto;
    box-shadow: none;
    border-radius: 0;
    background:
      repeating-linear-gradient(
        to bottom,
        #fff 0,
        #fff 34px,
        var(--paper-line) 35px
      );
    padding: 18px 24px 24px 60px;
  }

  .paper::before {
    left: 36px;
  }

  .paper-tear,
  .top-bar,
  .no-print,
  .modal-overlay {
    display: none !important;
  }

  .print-meta {
    display: block;
  }

  .admin-card,
  .login-card {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}

@media (max-width: 820px) {
  .paper {
    padding: 28px 18px 30px 56px;
  }

  .paper::before {
    left: 30px;
  }

  .paper-header h1 {
    font-size: 2.3rem;
  }

  .admin-header-row {
    align-items: flex-start;
  }

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

  .admin-item-actions {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding: 18px 10px 30px;
  }

  .paper {
    padding: 24px 14px 24px 44px;
    border-radius: 14px;
  }

  .paper::before {
    left: 22px;
  }

  .paper-header h1 {
    font-size: 2rem;
  }

  .button-row,
  .admin-form-row,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .admin-link,
  .top-link {
    width: 100%;
  }
}