/* TEMPUS. — LuvisYouth Design System（design skill §5 準拠） */
:root {
  --pink:    #E91B89;
  --purple:  #7B37A8;
  --blue:    #5BAADE;
  --gray:    #5A5A5A;
  --black:   #1A1A1A;
  --bg:      #F5F5F5;
  --surface: #FFFFFF;
  --line:    #E5E5E5;
  --success: #2E7D32;
  --error:   #C62828;
  --warning: #E65100;
  --gradient: linear-gradient(135deg, #E91B89 0%, #7B37A8 50%, #5BAADE 100%);

  --font-en: 'Oswald', 'Poppins', sans-serif;
  --font-ja: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;

  --radius: 4px;
  --space:  8px;

  /* MOTION TOKENS（motion.md §1 逐語） */
  --dur-instant: 100ms;
  --dur-fast:    180ms;
  --dur-base:    280ms;
  --dur-slow:    450ms;
  --dur-hero:    700ms;
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --stagger: 70ms;

  --shadow-card:
    0 0 0 1px rgba(0,0,0,0.06),
    0 1px 2px -1px rgba(0,0,0,0.06),
    0 2px 4px 0 rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--gray);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.app-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top)) 20px 8px;
  max-width: 560px; margin: 0 auto;
}
.brand-mark {
  font-family: var(--font-en); font-weight: 700; font-size: 22px;
  letter-spacing: 0.06em; color: var(--black); text-transform: uppercase;
}
.brand-dot { color: var(--pink); }
.brand-sub {
  display: block; font-family: var(--font-ja); font-weight: 700;
  font-size: 10px; letter-spacing: 0.12em; color: #8A8A8A;
}
.user-name { font-size: 12px; color: #8A8A8A; }

/* ---------- Layout ---------- */
main { max-width: 560px; margin: 0 auto; padding: 8px 16px 24px; }
.view { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card-label {
  font-family: var(--font-en); font-weight: 600; font-size: 11px;
  letter-spacing: 0.22em; text-transform: uppercase; color: #8A8A8A;
  margin-bottom: 12px;
}

/* ---------- ページロード演出（motion.md §2） ---------- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal {
  animation: rise-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

/* ---------- ホーム ---------- */
.today-line { margin: 4px 2px 0; font-size: 14px; font-weight: 500; color: var(--black); }
.clock {
  display: flex; align-items: baseline; gap: 6px; margin: -8px 0 0; min-height: 76px;
  font-family: var(--font-en); font-weight: 600; color: var(--black);
  font-variant-numeric: tabular-nums;
}
.clock > span:first-child { font-size: 64px; line-height: 1.1; letter-spacing: 0.02em; }
.clock-sec { font-size: 20px; color: #8A8A8A; width: 2ch; }

.shift-card .shift-body { font-size: 16px; font-weight: 700; color: var(--black); min-height: 26px; }
.shift-body .shift-off { color: var(--blue); }
.shift-body .shift-none { color: #8A8A8A; font-weight: 400; font-size: 14px; }

.punch-state { display: flex; gap: 8px; }
.punch-pill {
  flex: 1; display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 10px 14px;
}
.pill-key { font-size: 12px; font-weight: 700; color: #8A8A8A; }
.pill-val {
  font-family: var(--font-en); font-weight: 600; font-size: 18px;
  color: var(--black); font-variant-numeric: tabular-nums;
}
.punch-pill.done .pill-key { color: var(--success); }

.punch-area { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }
.punch-btn {
  width: 100%; min-height: 88px; border: 0; border-radius: 6px;
  background: var(--gradient);
  color: #FFFFFF; cursor: pointer;
  font-family: var(--font-ja); font-weight: 700; font-size: 22px; letter-spacing: 0.1em;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 2px 8px -2px rgba(233,27,137,0.35);
  transition: transform var(--dur-instant) var(--ease-out), box-shadow var(--dur-instant) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.punch-btn:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 4px 12px -2px rgba(233,27,137,0.45); }
.punch-btn:active { transform: scale(0.98); }
.punch-btn:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.punch-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.punch-btn.mode-out { background: var(--black); box-shadow: var(--shadow-card); }
.punch-btn.mode-done { background: var(--surface); color: var(--success); box-shadow: var(--shadow-card); font-size: 17px; }
.punch-btn.mode-holiday { background: var(--surface); color: var(--blue); box-shadow: var(--shadow-card); font-size: 17px; }

.opt-toggle {
  background: none; border: 0; color: #8A8A8A; font-size: 12px;
  text-decoration: underline; cursor: pointer; padding: 4px 8px; font-family: inherit;
}
.opt-toggle:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.punch-opts { width: 100%; display: flex; flex-direction: column; gap: 8px; }

.field { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.field span { font-size: 11px; font-weight: 700; color: #8A8A8A; }
.field input {
  border: 0; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-card); padding: 12px; font-size: 16px;
  font-family: inherit; color: var(--black); width: 100%;
}
.field input:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.field-row { display: flex; gap: 8px; margin-bottom: 12px; }

.msg { min-height: 22px; margin: 0 2px; font-size: 13px; font-weight: 500; }
.msg.ok { color: var(--success); }
.msg.err { color: var(--error); }

/* ---------- 月ナビ・統計 ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.month-title {
  margin: 0; font-family: var(--font-en); font-weight: 600; font-size: 20px;
  color: var(--black); letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
}
.month-btn {
  width: 44px; height: 44px; border: 0; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-card);
  font-size: 20px; color: var(--black); cursor: pointer;
  transition: transform var(--dur-instant) var(--ease-out);
}
.month-btn:active { transform: scale(0.94); }
.month-btn:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.stat-num {
  font-family: var(--font-en); font-weight: 600; font-size: 22px; color: var(--black);
  font-variant-numeric: tabular-nums; min-height: 28px;
}
.stat-key { font-size: 10px; font-weight: 700; color: #8A8A8A; letter-spacing: 0.08em; }

/* ---------- カレンダー ---------- */
.cal-card { padding: 16px 12px; }
.cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-size: 10px; font-weight: 700; color: #8A8A8A; margin-bottom: 8px; letter-spacing: 0.08em;
}
.cal-head .sat { color: var(--blue); }
.cal-head .sun { color: var(--error); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  aspect-ratio: 1 / 1.15; border: 0; border-radius: var(--radius);
  background: #F8F8F8; padding: 4px 2px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  font-family: inherit; cursor: pointer;
  transition: box-shadow var(--dur-instant) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
.cal-cell:active { transform: scale(0.95); }
.cal-cell:focus-visible { outline: 2px solid var(--pink); outline-offset: 1px; }
.cal-cell.empty { background: transparent; pointer-events: none; }
.cal-cell .d {
  font-family: var(--font-en); font-weight: 600; font-size: 13px; color: var(--black);
  font-variant-numeric: tabular-nums;
}
.cal-cell.today .d {
  color: #FFFFFF; background: var(--pink); border-radius: 50%;
  width: 20px; height: 20px; line-height: 20px; text-align: center;
}
.cal-cell .h { font-size: 9px; color: #8A8A8A; font-variant-numeric: tabular-nums; }
.cal-cell.is-off { background: rgba(91, 170, 222, 0.12); }
.cal-cell.is-off .d { color: var(--blue); }
.cal-cell.is-warn { box-shadow: inset 0 0 0 1.5px var(--warning); }
.cal-cell .bar {
  width: 70%; height: 3px; border-radius: 2px; background: var(--line); margin-top: auto; margin-bottom: 4px;
  overflow: hidden; position: relative;
}
.cal-cell .bar i { position: absolute; inset: 0; background: var(--black); transform-origin: left; display: block; }

.cal-legend { display: flex; gap: 16px; margin: -4px 2px 0; font-size: 11px; color: #8A8A8A; }
.cal-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot-work { background: var(--black); }
.dot-off { background: var(--blue); }
.dot-warn { background: var(--warning); }

.block-body { font-size: 13px; color: var(--gray); }
.block-body .blk { display: flex; justify-content: space-between; padding: 4px 0; border-top: 1px solid var(--line); }
.block-body .blk:first-child { border-top: 0; }
.block-body .ok { color: var(--success); font-weight: 700; }
.block-body .ng { color: var(--error); font-weight: 700; }

.day-detail { position: relative; }
.day-detail h3 { margin: 0 0 8px; font-size: 15px; color: var(--black); }
.day-detail dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 13px; }
.day-detail dt { color: #8A8A8A; font-weight: 700; }
.day-detail dd { margin: 0; color: var(--black); font-variant-numeric: tabular-nums; }

/* ---------- 休暇・給与 ---------- */
.hero-card { text-align: left; }
.hero-num {
  display: flex; align-items: baseline; gap: 4px; min-height: 64px;
  font-family: var(--font-en); font-weight: 700; color: var(--black);
}
.count-num { font-size: 56px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-unit { font-size: 20px; color: #8A8A8A; }
.hero-yen { font-size: 28px; color: #8A8A8A; }
.hero-sub { font-size: 12px; color: #8A8A8A; }

.duty-row { display: flex; align-items: center; gap: 12px; }
.duty-bar {
  flex: 1; height: 8px; border-radius: 4px; background: #F0F0F0; overflow: hidden;
}
.duty-fill {
  width: 100%; height: 100%; background: var(--gradient); border-radius: 4px;
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur-slow) var(--ease-out);
}
.duty-count {
  font-family: var(--font-en); font-weight: 600; font-size: 18px; color: var(--black);
  font-variant-numeric: tabular-nums;
}
.duty-note { font-size: 11px; color: #8A8A8A; margin: 8px 0 0; }

.leave-form { display: flex; gap: 8px; }
.date-input, .num-input {
  flex: 1; border: 0; border-radius: var(--radius); background: #F8F8F8;
  box-shadow: inset 0 0 0 1px var(--line); padding: 12px; font-size: 16px;
  font-family: inherit; color: var(--black); min-width: 0;
}
.num-input { flex: 0 0 72px; text-align: center; font-variant-numeric: tabular-nums; }
.date-input:focus-visible, .num-input:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.btn-primary, .btn-secondary {
  border: 0; border-radius: 2px; padding: 12px 20px; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  transition: transform var(--dur-instant) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.btn-primary { background: var(--pink); color: #FFFFFF; }
.btn-secondary { background: transparent; box-shadow: inset 0 0 0 1px var(--black); color: var(--black); }
.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }
.btn-primary:focus-visible, .btn-secondary:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.4; cursor: default; }

.history { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.history li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.history li:first-child { border-top: 0; }
.history .h-date { font-variant-numeric: tabular-nums; color: var(--black); font-weight: 500; }
.history .h-kind { font-weight: 700; }
.history .h-kind.k-grant { color: var(--success); }
.history .h-kind.k-use { color: var(--black); }
.history .h-note { color: #8A8A8A; flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pay-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.pay-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.pay-list li:first-child { border-top: 0; }
.pay-list b { font-variant-numeric: tabular-nums; color: var(--black); }
.frame-note { margin-top: 12px; font-size: 11px; color: #8A8A8A; }
.disclaimer { font-size: 11px; color: #8A8A8A; margin: -4px 2px 0; }

/* ---------- 管理 ---------- */
.admin-grid .cal-cell { cursor: pointer; }
.admin-grid .cal-cell.sel-work { background: var(--black); }
.admin-grid .cal-cell.sel-work .d { color: #FFFFFF; }
.admin-grid .cal-cell.sel-work .h { color: #C4C4C4; }
.admin-head { margin-top: 4px; }
.admin-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

.locked { text-align: center; padding: 40px 20px; }
.locked-msg { color: var(--gray); font-size: 14px; margin: 0; }

/* ---------- 規則リンク・シフトヒント ---------- */
.docs-card {
  display: block; text-decoration: none; color: var(--black);
  font-weight: 700; font-size: 14px;
  transition: transform var(--dur-instant) var(--ease-out);
}
.docs-card:active { transform: scale(0.98); }
.docs-card:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.cal-cell .h.sh { color: var(--blue); font-weight: 700; }

/* ---------- スケルトン ---------- */
@keyframes shimmer { from { background-position: -200px 0; } to { background-position: 200px 0; } }
.skeleton-line {
  color: transparent !important; border-radius: var(--radius);
  background: linear-gradient(90deg, #F0F0F0 25%, #F8F8F8 50%, #F0F0F0 75%);
  background-size: 200px 100%;
  animation: shimmer 1.6s linear infinite;
  user-select: none;
}

/* ---------- タブバー ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 -1px 0 rgba(0,0,0,0.06);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  max-width: 100%;
}
.tab {
  flex: 1; max-width: 96px; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0 4px; color: #8A8A8A; font-family: inherit;
  transition: color var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out);
  position: relative;
}
.tab:active { transform: scale(0.94); }
.tab:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; border-radius: var(--radius); }
.tab.active { color: var(--black); }
.tab-icon { font-size: 18px; line-height: 1; }
.tab-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; }
.tab-indicator {
  position: absolute; top: 0; height: 2px; width: 32px; border-radius: 1px;
  background: var(--pink);
  transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-fast);
  left: 0; opacity: 0;
}

/* ---------- REDUCED MOTION（motion.md §5 逐語） ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
