:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #66736d;
  --line: #d8e0dc;
  --paper: #f8fbf8;
  --panel: #ffffff;
  --soft: #eef5f0;
  --accent: #0b6b4f;
  --accent-dark: #084936;
  --amber: #b85f00;
  --blue: #2f5f8f;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(24, 35, 30, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(11, 107, 79, 0.08), rgba(184, 95, 0, 0.08)), var(--paper);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.app-shell,
.proof-page {
  width: min(1020px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.reminder-shell {
  width: min(1640px, calc(100% - 96px));
}

.domain-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.alert-board {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.alert-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}

.alert-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  min-height: 64px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.alert-item.due-overdue,
.alert-item.due-today {
  border-left-color: var(--danger);
}

.alert-item.due-week,
.alert-item.due-half {
  border-left-color: var(--amber);
}

.alert-item strong,
.alert-item span:not(.reminder-badge) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-item span:not(.reminder-badge) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.domain-tab {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
}

.domain-tab.is-active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

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

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  letter-spacing: 0;
}

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

.form-panel,
.admin-login,
.summary-strip,
.admin-tools,
.sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.form-panel,
.sheet {
  padding: 18px;
}

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

.panel-title span,
label > span,
.summary-strip span,
.proof-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 107, 79, 0.14);
}

.full-field {
  margin-top: 14px;
}

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

.check-tile {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  font-weight: 800;
}

.check-tile input,
.consent-panel input {
  width: 20px;
  min-height: 20px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  color: var(--accent-dark);
  background: rgba(11, 107, 79, 0.08);
  cursor: pointer;
  font-weight: 900;
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.photo-preview {
  display: none;
  width: 100%;
  max-height: 380px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

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

.photo-preview-grid figure {
  margin: 0;
}

.photo-preview-grid img {
  width: 100%;
  height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.signature-box {
  width: 100%;
  aspect-ratio: 3 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.consent-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(184, 95, 0, 0.28);
  border-radius: 8px;
  background: #fff8ef;
}

.consent-panel p {
  margin-bottom: 0;
  line-height: 1.5;
}

.consent-panel label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 850;
}

.submit-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0;
  background: linear-gradient(180deg, rgba(248, 251, 248, 0), var(--paper) 30%);
}

.primary-button,
.ghost-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
}

.primary-button {
  width: min(260px, 100%);
  border: 0;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.ghost-button,
.small-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.small-button {
  min-height: 36px;
  padding: 0 12px;
}

dialog {
  width: min(420px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dialog-content {
  padding: 22px;
}

.dialog-content p {
  line-height: 1.55;
}

.attendance-box {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.attendance-box img {
  width: 220px;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-login,
.admin-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--line);
}

.summary-strip div {
  display: grid;
  gap: 4px;
  padding: 14px;
  background: #fff;
}

.summary-strip strong {
  font-size: 24px;
}

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

.active-submission-list {
  display: grid;
  gap: 12px;
}

.active-submission-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.record-card {
  display: grid;
  grid-template-columns: 128px 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
}

.record-actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.record-card img {
  width: 128px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--soft);
}

.record-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 13px;
  font-weight: 850;
}

.record-title {
  margin: 0 0 7px;
  font-size: 18px;
  font-weight: 950;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  color: var(--muted);
  font-size: 13px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: var(--soft);
  font-size: 12px;
  font-weight: 850;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fff;
}

.completion-panel {
  display: grid;
  justify-items: start;
  gap: 12px;
}

.completion-panel p {
  margin-bottom: 0;
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: 950;
}

.muted {
  color: var(--muted);
}

.proof-body {
  background: #f4f7f5;
}

.sheet {
  background: #fff;
}

.proof-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.proof-summary div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.proof-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.proof-grid div {
  display: grid;
  grid-template-columns: 120px 1fr;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.proof-grid dt,
.proof-grid dd {
  margin: 0;
  padding: 12px;
}

.proof-grid dt {
  color: var(--muted);
  background: var(--soft);
  font-weight: 850;
}

.proof-section {
  margin-top: 16px;
}

.proof-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

figure {
  margin: 0;
}

figure img {
  width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

figcaption a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.proof-note {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.attendance-qr-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.attendance-qr-row p {
  margin-bottom: 6px;
}

.attendance-qr-row a {
  color: var(--accent);
  font-weight: 850;
  word-break: break-all;
}

.attendance-qr-row img {
  width: 160px;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.attendee-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.attendee-table th,
.attendee-table td {
  border: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.attendee-table th {
  color: var(--muted);
  background: var(--soft);
  font-weight: 850;
}

.attendee-signature {
  width: 120px;
  height: 48px;
  object-fit: contain;
  background: #fff;
}

@media (max-width: 760px) {
  .app-shell,
  .proof-page {
    width: min(100% - 18px, 1020px);
    padding-top: 14px;
  }

  h1 {
    font-size: 32px;
  }

  .screen-head {
    align-items: flex-start;
  }

  .form-panel,
  .sheet {
    padding: 14px;
  }

  .field-grid,
  .check-grid,
  .admin-login,
  .admin-tools,
  .reminder-tools,
  .summary-strip,
  .record-card,
  .reminder-card,
  .proof-summary,
  .proof-grid,
  .proof-media {
    grid-template-columns: 1fr;
  }

  .record-card img {
    width: 100%;
    height: 190px;
  }

  .active-submission-card {
    grid-template-columns: 1fr;
  }

  .record-photo-placeholder {
    width: 100%;
    height: 120px;
  }

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

  .record-card .ghost-button,
  .record-actions,
  .reminder-actions .ghost-button,
  .primary-button {
    width: 100%;
  }

  .header-actions,
  .reminder-actions {
    width: 100%;
    justify-content: stretch;
  }

  .proof-grid div {
    grid-template-columns: 104px 1fr;
  }

  .attendance-qr-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

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

  .ghost-button,
  .primary-button,
  .small-button {
    display: none !important;
  }

  .proof-page {
    width: 100%;
    padding: 0;
  }

  .sheet {
    box-shadow: none;
    border: 0;
  }
}

.admin-tools {
  grid-template-columns: minmax(220px, 1fr) 170px 170px auto;
}

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

.toolbar-actions .ghost-button {
  min-height: 46px;
  white-space: nowrap;
}

.day-strip,
.retention-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  padding: 12px;
}

.day-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.day-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 850;
}

.day-chip strong {
  color: var(--accent);
}

.retention-panel {
  display: grid;
  gap: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.retention-panel strong {
  color: var(--ink);
}

.reminder-layout {
  display: grid;
  grid-template-columns: minmax(420px, 540px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.reminder-board {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.category-sidebar,
.category-head,
.extra-field-panel,
.excel-import-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.category-sidebar {
  position: sticky;
  top: 14px;
  padding: 14px;
}

.category-sidebar .panel-title {
  margin-bottom: 10px;
}

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

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

.category-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.category-mini-button,
.category-add-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.category-menu {
  position: relative;
}

.category-icon-button {
  width: 42px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.category-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  display: grid;
  gap: 5px;
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}

.category-menu-panel[hidden] {
  display: none;
}

.category-menu-panel button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.category-menu-panel button:hover {
  background: var(--soft);
}

.category-menu-panel .danger-button {
  color: var(--danger);
}

.category-mini-button.danger-button {
  color: var(--danger);
}

.category-add-button {
  width: 100%;
  min-height: 40px;
  color: var(--accent-dark);
  background: var(--soft);
}

.category-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.category-button strong {
  color: var(--accent);
  font-size: 13px;
}

.category-button.is-active {
  border-color: rgba(11, 107, 79, 0.36);
  background: var(--soft);
}

.category-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

.category-head h2 {
  font-size: 27px;
}

.category-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.updated-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: var(--soft);
  font-size: 13px;
  font-weight: 850;
}

.field-grid label span small,
.full-field span small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.editable-label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.editable-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-edit-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-height: 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.label-edit-button:hover {
  border-color: var(--line);
  color: var(--accent-dark);
  background: var(--soft);
}

.edit-pencil-icon {
  display: inline-block;
  transform: scaleX(-1);
  transform-origin: 50% 50%;
}

.basis-select-field {
  display: grid;
  grid-template-columns: auto minmax(150px, 220px);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.basis-select-field select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 34px 0 11px;
  color: var(--ink);
  background-color: #fff;
  font-weight: 850;
}

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

.reminder-workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.reminder-tools {
  grid-template-columns: minmax(280px, 1fr) 150px auto;
}

.reminder-shell .record-list {
  display: block;
  min-width: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.extra-field-panel,
.excel-import-panel {
  padding: 14px;
}

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

.extra-field-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.detail-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.detail-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 750;
}

.detail-chip strong {
  color: var(--ink);
}

.excel-import-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.excel-import-row input[type="file"] {
  padding-top: 9px;
}

.reminder-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.reminder-card.due-overdue,
.reminder-card.due-today {
  border-left-color: var(--danger);
}

.reminder-card.due-week,
.reminder-card.due-half {
  border-left-color: var(--amber);
}

.reminder-card.due-month {
  border-left-color: var(--blue);
}

.reminder-card.due-ok {
  border-left-color: var(--accent);
}

.reminder-card.is-closed {
  opacity: 0.64;
}

.reminder-table-wrap {
  width: 100%;
  max-height: 68vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.reminder-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink);
}

.reminder-table th,
.reminder-table td {
  min-width: 112px;
  max-width: 280px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  background: #fff;
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
  word-break: keep-all;
}

.reminder-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: var(--muted);
  background: var(--soft);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.reminder-table .select-cell {
  min-width: 48px;
  width: 48px;
  max-width: 48px;
  text-align: center;
}

.reminder-table .select-cell input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.reminder-table th:first-child,
.reminder-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 48px;
  background: #fff;
}

.reminder-table th:first-child {
  z-index: 4;
  background: var(--soft);
}

.reminder-table th:nth-child(2),
.reminder-table td:nth-child(2) {
  position: sticky;
  left: 48px;
  z-index: 2;
  min-width: 92px;
  background: #fff;
}

.reminder-table th:nth-child(2) {
  z-index: 4;
  background: var(--soft);
}

.reminder-table th:nth-child(3),
.reminder-table td:nth-child(3) {
  position: sticky;
  left: 140px;
  z-index: 2;
  min-width: 118px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.reminder-table th:nth-child(3) {
  z-index: 4;
  background: var(--soft);
}

.reminder-table tr.due-overdue td:nth-child(2),
.reminder-table tr.due-today td:nth-child(2) {
  box-shadow: inset 5px 0 0 var(--danger);
}

.reminder-table tr.due-week td:nth-child(2),
.reminder-table tr.due-half td:nth-child(2) {
  box-shadow: inset 5px 0 0 var(--amber);
}

.reminder-table tr.due-ok td:nth-child(2) {
  box-shadow: inset 5px 0 0 var(--accent);
}

.reminder-table tr.is-closed td {
  color: var(--muted);
  background: #f8faf8;
}

.reminder-table .title-cell {
  min-width: 180px;
  max-width: 360px;
  font-weight: 900;
}

.reminder-table .basis-cell {
  color: var(--accent-dark);
  font-weight: 950;
  white-space: nowrap;
}

.reminder-table .date-cell {
  min-width: 116px;
  white-space: nowrap;
}

.reminder-table .memo-cell {
  min-width: 180px;
  max-width: 360px;
  white-space: pre-line;
}

.reminder-table .action-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 176px;
  background: #fff;
}

.reminder-table th:last-child {
  position: sticky;
  right: 0;
  z-index: 4;
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  white-space: nowrap;
}

.table-actions .small-button {
  min-height: 34px;
  padding: 0 9px;
  font-size: 13px;
}

.reminder-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
}

.reminder-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.due-overdue .reminder-badge,
.due-today .reminder-badge {
  background: var(--danger);
}

.due-week .reminder-badge,
.due-half .reminder-badge {
  background: var(--amber);
}

.due-ok .reminder-badge {
  background: var(--accent);
}

.reminder-path {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.reminder-memo {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.reminder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.reminder-actions .ghost-button {
  min-height: 40px;
  padding: 0 12px;
}

.danger-button {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.34);
}

@media (max-width: 900px) {
  .admin-tools {
    grid-template-columns: 1fr 1fr;
  }

  .search-field,
  .toolbar-actions {
    grid-column: 1 / -1;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions .ghost-button {
    flex: 1 1 130px;
  }

  .reminder-layout {
    grid-template-columns: 1fr;
  }

  .reminder-board {
    grid-template-columns: 1fr;
  }

  .reminder-form {
    position: static;
  }

  .category-sidebar {
    position: static;
  }

  .reminder-tools {
    grid-template-columns: 1fr 1fr;
  }

  .reminder-shell .record-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .reminder-shell {
    width: min(100% - 18px, 1020px);
  }

  .domain-tabs {
    grid-template-columns: 1fr;
  }

  .reminder-tools,
  .reminder-card,
  .extra-field-row,
  .excel-import-row {
    grid-template-columns: 1fr;
  }

  .reminder-actions,
  .header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .reminder-actions .ghost-button {
    width: 100%;
  }

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

@media print {
  .admin-shell .screen-head,
  .reminder-shell .screen-head,
  .admin-login,
  .admin-tools,
  .reminder-form,
  .day-strip,
  .retention-panel,
  .record-card img,
  .record-card .ghost-button,
  .reminder-actions {
    display: none !important;
  }

  .summary-strip,
  .record-card,
  .reminder-card {
    box-shadow: none;
    break-inside: avoid;
  }

  .record-card,
  .reminder-card,
  .reminder-layout {
    grid-template-columns: 1fr;
  }
}
