*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --green: #2f6b45;
  --green-soft: #e8f2ec;
  --border: #d7ddd9;
  --bg: #eef2ef;
  --card: #ffffff;
  --text: #1b241e;
  --muted: #66736a;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.btn {
  padding: 9px 14px;
  border: 1px solid #b8c2bb;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

.btn:hover {
  background: #f3f6f4;
}

.btn-primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn-primary:hover {
  background: #255637;
}

.brand-mark {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 700;
}

.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, #d9ebe0 0%, transparent 40%),
    linear-gradient(160deg, #eef5f0 0%, #eef2ef 55%);
}

.admin-login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 16px 40px rgba(31, 61, 42, 0.08);
}

.admin-login-card h1 {
  margin: 6px 0 8px;
  font-size: 28px;
}

.admin-login-sub {
  margin: 0 0 24px;
  color: var(--muted);
}

.admin-login-card label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.admin-login-card input {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 14px;
  border: 1px solid #c5cec8;
  border-radius: 8px;
  font-size: 14px;
}

.admin-login-card button {
  width: 100%;
  margin-top: 4px;
}

.admin-error {
  color: #b00020;
  margin: 0 0 10px;
}

.admin-back {
  text-align: center;
  margin: 18px 0 0;
}

.admin-back a {
  color: var(--green);
  text-decoration: none;
}

.admin-app {
  min-height: 100vh;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.admin-header h1 {
  margin: 4px 0 0;
  font-size: 24px;
}

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

.admin-user-name {
  font-weight: 700;
  margin-right: 4px;
}

.admin-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 40px;
}

.latest-card {
  background: linear-gradient(135deg, #234f34 0%, #3d7a55 100%);
  color: #fff;
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 18px;
}

.latest-label {
  margin: 0 0 8px;
  opacity: 0.8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.latest-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
}

.latest-meta {
  margin: 8px 0 0;
  opacity: 0.9;
  font-size: 13px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.stat-row div {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat-row span {
  display: block;
  font-size: 12px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.stat-row strong {
  font-size: 22px;
}

.filter-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.filter-grow {
  flex: 1 1 240px;
}

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

.filter-field input,
.filter-field select {
  padding: 10px 12px;
  border: 1px solid #c5cec8;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  min-height: 40px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 1px;
}

.date-help {
  margin: 0;
  padding-top: 4px;
  border-top: 1px solid #e7ece9;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.date-help strong {
  color: var(--text);
}

.results-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #e7ece9;
}

.results-bar h2 {
  margin: 0;
  font-size: 16px;
}

#result-count {
  color: var(--muted);
  font-size: 13px;
}

.admin-table-wrap {
  overflow: auto;
}

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

.admin-table th,
.admin-table td {
  border-bottom: 1px solid #edf1ee;
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: #f6f8f7;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  position: sticky;
  top: 0;
}

.admin-table tbody tr:hover {
  background: #f7fbf8;
}

.col-num {
  width: 48px;
}

.col-date {
  width: 180px;
}

.col-open {
  width: 110px;
}

.empty-row {
  text-align: center;
  color: #8a958e;
  padding: 36px !important;
}

.cell-file {
  font-weight: 700;
  max-width: 240px;
}

.cell-sheet {
  color: #355943;
  font-weight: 600;
}

.cell-details {
  max-width: 340px;
  word-break: break-word;
  color: #334038;
  line-height: 1.45;
}

.cell-time-main {
  display: block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-time-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.btn-open {
  display: inline-block;
  text-decoration: none;
  color: var(--green);
  border: 1px solid var(--green);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.btn-open:hover {
  background: #d7eadf;
}

.print-only {
  display: none;
}

@media (max-width: 800px) {
  .stat-row {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .admin-main {
    padding-left: 14px;
    padding-right: 14px;
  }
}

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

  .no-print {
    display: none !important;
  }

  .print-only {
    display: block;
    padding: 0 0 12px;
  }

  .admin-app {
    display: block !important;
  }

  .results-panel {
    border: none;
    border-radius: 0;
  }

  .admin-table {
    min-width: 0;
    font-size: 11px;
  }

  .admin-table th {
    position: static;
  }

  .admin-table th,
  .admin-table td {
    border: 1px solid #999;
    padding: 6px 8px;
  }
}
