:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #66737f;
  --line: #dce2e7;
  --primary: #1769aa;
  --primary-dark: #0e4f84;
  --secondary: #eef5fb;
  --success: #1d7a46;
  --warning: #946200;
  --danger: #b42318;
  --shadow: 0 8px 24px rgba(24, 39, 58, 0.07);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Yu Gothic", sans-serif;
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-header { background: #122b40; color: #fff; position: sticky; top: 0; z-index: 20; }
.header-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: #fff; font-weight: 800; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav a, .link-button { color: #fff; font-size: .93rem; }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; background: transparent; padding: 0; }
.link-button:hover { text-decoration: underline; }
.page { min-height: calc(100vh - 125px); padding: 30px 0 50px; }
.site-footer { color: var(--muted); font-size: .82rem; padding: 16px 0 28px; }

h1, h2, h3 { line-height: 1.25; margin-top: 0; }
h1 { font-size: clamp(1.55rem, 3vw, 2.15rem); margin-bottom: 8px; }
h2 { font-size: 1.2rem; margin-bottom: 16px; }
p { margin-top: 0; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.admin-grid { grid-template-columns: minmax(280px, .8fr) minmax(0, 1.5fr); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 750; text-decoration: none; transition: .15s ease; }
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: var(--secondary); color: var(--primary-dark); border-color: #c9ddec; }
.button-ghost { background: #fff; color: var(--text); border-color: var(--line); }
.button-danger { background: var(--danger); color: #fff; }
.button-danger-outline { color: var(--danger); border-color: #efb9b4; background: #fff; }
.button-small { min-height: 34px; padding: 6px 10px; font-size: .84rem; }
.button-full { width: 100%; }

.punch-card { display: grid; grid-template-columns: 1fr auto auto; gap: 28px; align-items: center; }
.punch-card h2 { margin: 0; }
.punch-times { display: flex; gap: 28px; }
.punch-times div { display: grid; gap: 2px; text-align: center; min-width: 76px; }
.punch-times span { color: var(--muted); font-size: .82rem; }
.punch-times strong { font-size: 1.85rem; font-variant-numeric: tabular-nums; }
.punch-actions { display: flex; gap: 10px; }
.punch-actions form { margin: 0; }
.button-clock-in, .button-clock-out { min-width: 130px; min-height: 54px; color: #fff; font-size: 1.05rem; }
.button-clock-in { background: #16794d; }
.button-clock-out { background: #34546f; }

.stack-form { display: grid; gap: 16px; }
.stack-form label, .filter-form label, .decision-form label { display: grid; gap: 6px; font-weight: 700; color: #384550; }
input, select, textarea { width: 100%; border: 1px solid #c8d1d9; border-radius: 9px; padding: 10px 12px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(23, 105, 170, .16); border-color: var(--primary); }
textarea { resize: vertical; }
.form-card { max-width: 760px; }
.narrow-card { max-width: 560px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-help { font-size: .78rem; color: var(--muted); font-weight: 400; }
.check-label { display: flex !important; align-items: center; gap: 8px !important; }
.check-label input { width: auto; }
.filter-form { display: grid; grid-template-columns: 180px minmax(220px, 1fr) auto auto; gap: 12px; align-items: end; margin-bottom: 20px; }

.auth-wrap { display: grid; place-items: center; min-height: 66vh; }
.auth-card { width: min(440px, 100%); }
.error-card { max-width: 680px; margin: 50px auto; text-align: center; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; letter-spacing: .03em; }
td { font-size: .93rem; }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.flash-list { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { border-radius: 10px; padding: 11px 14px; border: 1px solid transparent; }
.flash-success { background: #edf8f1; color: #155c36; border-color: #b9dfc8; }
.flash-warning { background: #fff8e7; color: #775000; border-color: #ecd69b; }
.flash-danger { background: #fff0ef; color: #92241a; border-color: #efb9b4; }

.status { display: inline-flex; white-space: nowrap; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: .76rem; font-weight: 800; }
.status-pending { color: #7a5100; background: #fff1c9; }
.status-approved { color: #12643b; background: #dff3e8; }
.status-rejected { color: #94251a; background: #fde3e0; }
.status-canceled { color: #5e6871; background: #e9edf0; }

.request-list { display: grid; gap: 12px; }
.request-item { border: 1px solid var(--line); border-radius: 11px; padding: 15px; }
.request-item p:last-child { margin-bottom: 0; }
.request-main { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 9px; }
.request-main div { display: grid; gap: 3px; }
.request-main span:not(.status) { color: var(--muted); font-size: .86rem; }
.admin-comment { background: #f3f6f8; border-left: 3px solid #93a7b5; padding: 8px 10px; font-size: .88rem; }
.reason-box { white-space: pre-wrap; background: #f8fafb; border-radius: 8px; padding: 10px; }
.decision-form { display: grid; gap: 10px; margin-top: 14px; }
.tabs { display: flex; gap: 5px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 10px 13px; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; }
.tab.active { color: var(--primary); border-color: var(--primary); font-weight: 800; }

.employee-list { display: grid; gap: 12px; }
.employee-item { border: 1px solid var(--line); border-radius: 11px; padding: 14px; display: grid; gap: 10px; }
.employee-item.is-inactive { opacity: .67; background: #f5f6f7; }
.employee-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.employee-title div { display: grid; gap: 2px; }
.employee-title div span { color: var(--muted); font-size: .8rem; }
.inline-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

@media (max-width: 850px) {
  .header-inner { align-items: flex-start; padding: 14px 0; }
  .nav { justify-content: flex-end; gap: 10px 14px; }
  .punch-card { grid-template-columns: 1fr; gap: 18px; }
  .punch-times { justify-content: flex-start; }
  .punch-actions { width: 100%; }
  .punch-actions form { flex: 1; }
  .button-clock-in, .button-clock-out { width: 100%; min-width: 0; }
  .grid-two, .admin-grid { grid-template-columns: 1fr; }
  .filter-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .container { width: min(100% - 20px, 1120px); }
  .site-header { position: static; }
  .header-inner { display: grid; }
  .nav { justify-content: flex-start; }
  .page { padding-top: 18px; }
  .page-heading { align-items: flex-start; display: grid; }
  .page-heading > .button, .page-heading > .button-row { width: 100%; }
  .page-heading .button-row .button { flex: 1; }
  .card { padding: 16px; border-radius: 12px; }
  .form-grid, .filter-form { grid-template-columns: 1fr; }
  .punch-times { width: 100%; justify-content: space-around; }
  .punch-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .request-main, .employee-title { align-items: flex-start; }
  .inline-actions { grid-template-columns: 1fr; }
}
