.app-link { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.main-menu .menu-link { color: inherit; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: .45rem; min-height: 48px; padding: .6rem .7rem; border: 0; border-radius: 10px; font-weight: 700; }
.main-menu .menu-link:hover { background: var(--surface-soft); }
:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #657383;
  --line: #dce3e8;
  --canvas: #f3f6f8;
  --paper: #ffffff;
  --green: #176b5b;
  --green-dark: #0e4f43;
  --green-soft: #e9f5f1;
  --gold: #d9a441;
  --gold-dark: #8b5b00;
  --red: #b42318;
  --red-soft: #fff1f0;
  --shadow: 0 18px 45px rgba(34, 51, 65, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--canvas); -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 8% 2%, rgba(23, 107, 91, 0.12), transparent 28rem), var(--canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select, input[type="checkbox"], input[type="radio"], input[type="file"] { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .58; }
[hidden] { display: none !important; }
a { color: var(--green-dark); }

.app-shell { width: min(1024px, 100%); min-height: 100vh; margin: 0 auto; background: rgba(243, 246, 248, .72); }
.app-header {
  position: relative;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 20px;
  color: #fff;
  background: linear-gradient(115deg, #0e4f43, #176b5b 62%, #237d6b);
  box-shadow: 0 3px 16px rgba(14, 79, 67, .2);
}
.brand, .header-actions, .inline-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  font-size: 18px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: .04em; }
.brand small { margin-top: 1px; color: rgba(255,255,255,.72); font-size: .68rem; letter-spacing: .12em; }
.current-time { display: grid; text-align: right; font-variant-numeric: tabular-nums; }
.current-time strong { font-size: 1.4rem; }
.current-time span { color: rgba(255,255,255,.76); font-size: .72rem; }

.main-menu {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.main-menu button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
}
.main-menu button[aria-selected="true"] { color: var(--green-dark); background: var(--green-soft); }
.main-menu button:disabled { color: var(--muted); }

main { padding: 22px; }
.page-width { width: min(100%, 980px); margin-inline: auto; }
.time-test-card { border-color: #e4bf67; background: #fffaf0; }
.time-test-card .panel-header { border-bottom-color: #eed9aa; }
.time-test-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.punch-bottom-actions { margin-top: 18px; display: grid; gap: 12px; }
.punch-bottom-actions > #previewButton { min-height: 56px; font-size: 1.02rem; }
.auth-loading { min-height: calc(100vh - 112px); display: grid; place-items: center; padding: 24px; color: var(--muted); font-weight: 700; }
.login-layout { min-height: calc(100vh - 112px); display: grid; place-items: center; padding: 28px 20px; }
.login-card, .panel, .report, .camera-card, .form-card {
  border: 1px solid rgba(211, 222, 215, .92);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.login-card { width: min(480px, 100%); overflow: hidden; }
.card-header, .panel-header { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.card-body, .panel-body { padding: 22px 24px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .1em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(1.55rem, 4vw, 2rem); line-height: 1.3; }
h2 { margin-bottom: 10px; font-size: 1.16rem; }
h3 { margin-bottom: 8px; font-size: .98rem; }
.muted { color: var(--muted); }
.small { font-size: .78rem; }
.stack { display: grid; gap: 16px; }
.panel-spacer { margin-bottom: 14px; }
.actions-spacer { margin-top: 12px; }
.plain-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.plain-fieldset legend { margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { min-width: 0; display: grid; gap: 6px; color: #405552; font-size: .82rem; font-weight: 700; }
.field-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.manual-toggle { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.manual-toggle input { width: 18px; height: 18px; accent-color: var(--green); }
.field input[readonly] { color: #405552; background: #eef2ef; cursor: default; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #bec9d1;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(23,107,91,.16); border-color: var(--green); }
.check-field, .radio-option { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.check-field input, .radio-option input { width: 20px; height: 20px; accent-color: var(--green); }
.radio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 8px; }
.radio-option { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

.primary, .secondary, .danger, .ghost, .segment-button {
  min-height: 44px;
  border-radius: 10px;
  padding: 9px 14px;
  border: 1px solid transparent;
  font-weight: 700;
}
.primary { color: #fff; background: var(--green); }
.primary:hover:not(:disabled) { background: var(--green-dark); }
.secondary { color: var(--ink); border-color: #d2dbd6; background: #fff; }
.secondary:hover:not(:disabled) { color: var(--green-dark); border-color: var(--green); }
.danger { color: var(--red); border-color: #e0b8b5; background: #fff; }
.ghost { color: var(--green-dark); background: transparent; }
.block { width: 100%; }
.header-button { color: #fff; border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.1); }
.segment { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segment-button { min-height: 66px; color: var(--ink); border-color: var(--line); background: #fff; text-align: left; }
.segment-button[aria-pressed="true"] { color: var(--green-dark); border-color: var(--green); background: var(--green-soft); }

.message { margin: 12px 0 0; border: 1px solid #acd5c6; border-radius: 10px; padding: 11px 13px; color: var(--green-dark); background: var(--green-soft); line-height: 1.55; }
.message.error { color: var(--red); border-color: #ebcdcd; background: var(--red-soft); }
.message.warning { color: #66470e; border-color: #d7ad5c; background: #fff6d8; }
.status-line { min-height: 24px; }
.busy::after { content: "処理中…"; }

.punch-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(290px, .85fr); gap: 16px; }
.punch-column { display: grid; align-content: start; gap: 16px; }
.actor-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid #cbd9d4; border-radius: 15px; background: rgba(255,255,255,.9); }
.actor-strip strong, .actor-strip span { display: block; }
.camera-card { overflow: hidden; }
.camera-stage { min-height: 300px; display: grid; place-items: center; overflow: hidden; background: #18221f; }
.camera-stage video, .camera-stage img { width: 100%; max-height: 390px; object-fit: cover; }
.camera-placeholder { color: #e8f5f1; text-align: center; padding: 40px 20px; }
.camera-actions { display: grid; gap: 10px; padding: 16px; }
.capture-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.capture-label { min-height: 48px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--green); font-weight: 800; cursor: pointer; }
.confirmation-box { padding: 16px; border-radius: 14px; background: var(--green-soft); }
.confirmation-box strong { display: block; margin-bottom: 10px; }
.punch-confirmation-dialog { width: min(520px, calc(100% - 28px)); }
.confirmation-summary { display: grid; gap: 12px; }
.confirmation-summary strong { padding: 16px; border-radius: 12px; color: var(--green-dark); background: var(--green-soft); font-size: 1.08rem; line-height: 1.7; }
.prompt-list { display: grid; gap: 12px; }
.prompt { padding: 13px; border: 1px solid #d7c48d; border-radius: 10px; background: #fff8df; }

.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-grid { flex: 1 1 620px; display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 10px; }
.report { overflow: hidden; box-shadow: none; }
.report-header { padding: 18px 20px; background: linear-gradient(135deg, #fff, var(--green-soft)); }
.summary-wrap { padding: 0 20px 18px; }
.summary-table, .records-table { width: 100%; border-collapse: collapse; }
.summary-table th, .summary-table td { border: 1px solid #e1e7e3; padding: 8px 9px; }
.summary-table th { width: 24%; background: var(--green-soft); text-align: left; font-size: .82rem; }
.summary-table td { width: 26%; font-family: Consolas, "Yu Gothic UI", monospace; }
.records-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fbfcfb; }
.view-switch { display: flex; gap: 6px; }
.view-switch button[aria-pressed="true"] { color: #fff; border-color: var(--green); background: var(--green); }
.table-wrap { max-width: 100%; overflow-x: auto; }
.records-table { min-width: 2250px; }
.records-table.simple { min-width: 1120px; }
.records-table th, .records-table td { padding: 9px 8px; border-right: 1px solid #e7ece8; border-bottom: 1px solid #e7ece8; text-align: center; white-space: nowrap; font-size: .79rem; }
.records-table th { color: #4f5c56; background: #f2f6f3; }
.records-table tbody tr:nth-child(even) { background: #fbfcfb; }
.records-table tbody tr:hover { background: #f2f7f4; }
.records-table .time { font-family: Consolas, "Yu Gothic UI", monospace; font-size: .92rem; font-weight: 700; }
.records-table .notes { max-width: 220px; white-space: normal; text-align: left; }
.detail-only.hidden-column { display: none; }
.status { display: inline-flex; min-height: 28px; align-items: center; border-radius: 999px; padding: 3px 9px; color: var(--green-dark); background: var(--green-soft); font-size: .72rem; font-weight: 700; }
.status.pending { color: var(--gold-dark); background: #fff5df; }
.status.rejected { color: var(--red); background: var(--red-soft); }
.work-type.leave { color: var(--red); background: var(--red-soft); }
.work-type.night { color: #a94700; background: #fff0dc; }
.mobile-records { display: none; }
.day-card { overflow: hidden; border: 1px solid #dde5df; border-radius: 13px; background: #fff; }
.day-card-header { display: flex; justify-content: space-between; gap: 10px; padding: 12px; border-bottom: 1px solid #e9eeea; }
.day-grid { display: grid; grid-template-columns: 1fr 1fr; }
.day-grid > div { min-height: 58px; padding: 10px 12px; border-right: 1px solid #edf1ee; border-bottom: 1px solid #edf1ee; }
.day-grid small, .day-grid strong { display: block; }
.day-grid small { color: var(--muted); font-size: .72rem; }
.day-grid strong { margin-top: 3px; font-size: .88rem; }
.day-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px; }

.application-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 16px; }
.application-list { display: grid; gap: 10px; }
.application-item { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.application-item-header { display: flex; justify-content: space-between; gap: 10px; }
.review-grid { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.review-row { display: grid; grid-template-columns: minmax(100px, .7fr) 1fr 28px 1fr; align-items: center; gap: 8px; padding: 10px 12px; background: #fff; }
.review-row strong { color: #405552; font-size: .8rem; }
.review-arrow { color: var(--green); text-align: center; font-weight: 800; }
.review-before { color: var(--muted); text-decoration: line-through; }
.review-after { color: var(--green-dark); font-weight: 700; }
.photo-viewer { min-height: 260px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: #17211f; }
.photo-viewer img { width: 100%; max-height: 60vh; object-fit: contain; }
.photo-tabs { display: flex; gap: 8px; flex-wrap: wrap; }

dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100vh - 32px); overflow: auto; border: 0; border-radius: 18px; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 28px 80px rgba(13, 47, 43, .3); }
dialog::backdrop { background: rgba(19,34,30,.52); }
.dialog-header { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 20px 22px; }
.dialog-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 12px 22px; border-top: 1px solid var(--line); background: #fff; }

.launcher { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.launcher-panel { width: min(760px, 100%); }
.launcher-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.launcher-link { min-height: 170px; display: grid; align-content: center; gap: 8px; padding: 24px; border: 1px solid rgba(211,222,215,.92); border-radius: 18px; color: var(--ink); background: #fff; box-shadow: var(--shadow); text-decoration: none; }
.launcher-link:hover { border-color: var(--green); transform: translateY(-1px); }
.launcher-link strong { color: var(--green-dark); font-size: 1.2rem; }
.launcher-footer, .site-footer { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; }
.launcher-footer { margin-top: 24px; }
.site-footer { padding: 20px; border-top: 1px solid var(--line); background: rgba(255,255,255,.82); }
.app-footer { width: min(1024px, 100%); margin: 0 auto; }
.legal-shell { min-height: 100vh; background: rgba(243, 246, 248, .82); }
.legal-page { width: min(900px, 100%); margin-inline: auto; padding: 30px 22px 44px; }
.legal-hero, .legal-content section { border: 1px solid rgba(211,222,215,.92); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 26px rgba(34,51,65,.07); }
.legal-hero { margin-bottom: 16px; padding: clamp(24px, 5vw, 42px); background: linear-gradient(135deg, #fff, var(--green-soft)); }
.legal-hero > p:not(.eyebrow) { max-width: 72ch; margin-bottom: 18px; line-height: 1.85; }
.legal-meta { display: flex; gap: 10px 26px; flex-wrap: wrap; margin: 0; }
.legal-meta div { display: flex; gap: 8px; }
.legal-meta dt { color: var(--muted); font-weight: 700; }
.legal-meta dd { margin: 0; font-variant-numeric: tabular-nums; }
.legal-content { display: grid; gap: 14px; }
.legal-content section { padding: clamp(20px, 4vw, 30px); }
.legal-content h2 { padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--green-dark); font-size: 1.16rem; }
.legal-content p, .legal-content li, .legal-content dd, .legal-content address { line-height: 1.85; }
.legal-content p:last-child, .legal-content ul:last-child, .legal-content dl:last-child { margin-bottom: 0; }
.legal-content ul { margin: 0; padding-left: 1.4em; }
.legal-content li + li { margin-top: 5px; }
.legal-definition-list { margin: 0; }
.legal-definition-list div { display: grid; grid-template-columns: minmax(120px, .32fr) 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px solid #edf1ee; }
.legal-definition-list div:last-child { border-bottom: 0; }
.legal-definition-list dt { color: #405552; font-weight: 800; }
.legal-definition-list dd { margin: 0; }
.legal-content address { font-style: normal; }

@media (max-width: 760px) {
  .punch-grid, .application-layout { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  main { padding: 16px; }
  .app-header { padding-inline: 14px; }
  .summary-table tr { display: grid; grid-template-columns: 1fr 1fr; }
  .summary-table th, .summary-table td { width: auto; }
}

@media (max-width: 540px) {
  .app-header { align-items: flex-start; }
  .brand small { display: none; }
  .current-time span { font-size: .65rem; }
  .main-menu { grid-template-columns: 1fr 1fr; padding: 8px; }
  .main-menu button, .main-menu .menu-link { min-height: 52px; flex-direction: column; gap: 2px; font-size: .8rem; }
  main, .login-layout { padding: 12px; }
  .card-header, .panel-header, .card-body, .panel-body { padding-inline: 16px; }
  .form-grid, .form-grid.three, .filter-grid { grid-template-columns: 1fr; }
  .time-test-grid { grid-template-columns: 1fr; }
  .segment { grid-template-columns: 1fr; }
  .actor-strip { align-items: flex-start; flex-direction: column; }
  .summary-wrap { padding-inline: 10px; overflow-x: auto; }
  .summary-table { min-width: 470px; }
  .table-wrap { display: none; }
  .mobile-records { display: grid; gap: 10px; padding: 11px; background: #eef2ef; }
  .records-toolbar { align-items: stretch; flex-direction: column; }
  .records-toolbar > * { width: 100%; }
  .view-switch { display: grid; grid-template-columns: 1fr 1fr; }
  .application-item-header { flex-direction: column; }
  .review-row { grid-template-columns: 1fr; }
  .review-arrow { display: none; }
  .launcher-grid { grid-template-columns: 1fr; }
  .legal-page { padding: 16px 12px 30px; }
  .legal-definition-list div { grid-template-columns: 1fr; gap: 2px; }
  input, select, textarea { font-size: 16px !important; }
}

@media print {
  body { background: #fff; }
  .app-header, .main-menu, .toolbar, .records-toolbar, .no-print, dialog { display: none !important; }
  .app-shell, main { width: 100%; padding: 0; background: #fff; }
  .report { border: 0; box-shadow: none; }
  .table-wrap { display: block; overflow: visible; }
  .records-table { min-width: 0; font-size: 7pt; }
  .records-table th, .records-table td { padding: 1mm .35mm; white-space: normal; }
}
