:root {
  --bg: #f4efe5;
  --paper: #fffdf8;
  --ink: #34261b;
  --muted: #7a6756;
  --line: #e3d6c6;
  --brand: #8c2f1c;
  --brand-deep: #5f190f;
  --accent: #d8a84d;
  --good: #3f7b5d;
  --shadow: 0 18px 40px rgba(71, 42, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(216, 168, 77, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(140, 47, 28, 0.12), transparent 20%),
    linear-gradient(180deg, #f8f2e9 0%, var(--bg) 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(520px, 100%);
  padding: 30px;
  background: var(--paper);
  border: 1px solid rgba(227, 214, 198, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.eyebrow.dark {
  color: var(--brand);
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
}

.login-text {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

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

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

.page-shell.narrow {
  width: min(900px, calc(100% - 32px));
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 20px;
  padding: 28px;
  background: linear-gradient(135deg, rgba(140, 47, 28, 0.96), rgba(111, 29, 17, 0.94));
  color: #fff8ef;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero.compact {
  grid-template-columns: 1.3fr 0.7fr;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.2em;
  color: #f7d9a3;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
}

.hero-text {
  margin: 12px 0 0;
  max-width: 700px;
  font-size: 18px;
  line-height: 1.7;
  color: rgba(255, 248, 239, 0.88);
}

.hero-panel {
  align-self: stretch;
  background: linear-gradient(180deg, rgba(255, 247, 232, 0.16), rgba(255, 247, 232, 0.08));
  border: 1px solid rgba(255, 226, 181, 0.2);
  border-radius: 24px;
  padding: 22px;
  display: grid;
  gap: 10px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(247, 217, 163, 0.14);
  color: #ffdca0;
  font-size: 14px;
}

.hero-date {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
}

.hero-date.user-name {
  font-size: 28px;
}

.hero-note {
  color: rgba(255, 248, 239, 0.84);
  line-height: 1.7;
}

.message-box {
  margin-top: 18px;
  padding: 14px 18px;
  background: #f4fff8;
  border: 1px solid #b7dcc5;
  color: var(--good);
  border-radius: 18px;
  font-weight: 600;
}

.stats-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card,
.panel {
  background: var(--paper);
  border: 1px solid rgba(227, 214, 198, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 22px;
}

.stat-label {
  color: var(--muted);
  font-size: 15px;
}

.stat-value {
  margin-top: 10px;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 700;
  color: var(--brand-deep);
}

.stat-value.small {
  font-size: 24px;
}

.stat-sub {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.content-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 18px;
}

.panel {
  padding: 22px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 28px;
}

.panel-header p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.entry-form,
.filter-form {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

label span {
  color: var(--ink);
}

label.full,
.form-actions.full {
  grid-column: 1 / -1;
}

input,
select,
button,
a.secondary-btn {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 3px solid rgba(216, 168, 77, 0.25);
  border-color: var(--accent);
}

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

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border: none;
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand), #b24323);
  color: #fffaf3;
  box-shadow: 0 14px 28px rgba(140, 47, 28, 0.22);
}

.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border: none;
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
  background: linear-gradient(135deg, #8c1c1c, #bb2b2b);
  color: #fffaf3;
  box-shadow: 0 14px 28px rgba(140, 28, 28, 0.2);
}

.secondary-btn {
  background: #fff7ea;
  color: var(--brand-deep);
  border: 1px solid #e7ceb0;
}

.logout-btn {
  margin-top: 6px;
  width: fit-content;
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.list-meta {
  margin-top: 14px;
  color: var(--muted);
  font-weight: 600;
}

.pagination-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-btn {
  min-height: 42px;
}

.disabled-btn {
  pointer-events: none;
  opacity: 0.45;
}

.action-cell {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form {
  margin: 0;
}

.inline-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
}

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

thead {
  background: #f8f1e3;
}

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

tbody tr:nth-child(even) {
  background: rgba(248, 241, 227, 0.45);
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 28px 16px;
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 780px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    margin-top: 12px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .hero-panel {
    padding: 18px;
  }

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

  .stat-card,
  .panel,
  .login-card {
    padding: 18px;
    border-radius: 20px;
  }

  .panel-header h2,
  .login-card h1 {
    font-size: 26px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .hero-text,
  .panel-header p,
  .login-text {
    font-size: 16px;
  }

  .entry-form,
  .filter-form {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .logout-btn,
  .inline-btn {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
    border: none;
    margin-top: 14px;
  }

  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table th,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table {
    min-width: 0;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: grid;
    gap: 12px;
  }

  .responsive-table tr {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px 12px;
    box-shadow: 0 10px 24px rgba(71, 42, 24, 0.08);
  }

  .responsive-table td {
    border-bottom: 1px solid rgba(227, 214, 198, 0.75);
    padding: 10px 0;
    text-align: left;
  }

  .responsive-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .responsive-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .action-cell {
    flex-direction: column;
    gap: 8px;
  }

  .empty-row {
    text-align: left;
    padding: 16px 0 4px;
  }

  .empty-row::before {
    display: none;
  }
}
