/* Clockee の配色 (HomePalette.swift): 緑 = 出勤・勤務中、アンバー = 退勤、紫 = 休憩、青 = 再開・有給。
   鮮やかな塗りの上の文字は白ではなく濃い同系色。グラデーションと色の付いた影は使わない。
   見た目は「A 時計を主役に」(2026-11-23 オーナー判断): 大きな時計・1日のバー・大きな打刻ボタン。 */
:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1c2420;
  --muted: #5f6b65;
  --line: #e2e7e4;
  --brand-fill: #3ddc84;  --on-brand: #00391c;  --brand-text: #0f7a40;  --brand-tint: #ddf8e8;
  --amber-fill: #ffb020;  --on-amber: #4a2c00;
  --purple-fill: #b69cff; --on-purple: #2a1166; --purple-text: #6a35e0; --purple-tint: #eee7fe;
  --blue-fill: #5ab4ff;   --on-blue: #00325c;
  --error: #c62828;       --error-tint: #fdecea;
  --notice-tint: #e6f8ee;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101412;
    --card: #1b211e;
    --text: #eef2f0;
    --muted: #a3aea8;
    --line: #2c3430;
    --brand-text: #6be8a3;  --brand-tint: #123321;
    --purple-text: #c2a9ff; --purple-tint: #2a1d4a;
    --error: #ff8a80;       --error-tint: #3a1d1b;
    --notice-tint: #143323;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
  line-height: 1.5;
}
main { max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; }

/* 見出し: 日付と所属・名前・頭文字の丸 */
header { margin: 4px 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.who { min-width: 0; }
.company { margin: 0; color: var(--muted); font-size: 0.85rem; }
h1 { margin: 0; font-size: 1.4rem; overflow-wrap: anywhere; }
h2 { margin: 0 0 8px; font-size: 1rem; }
.date { margin: 0; color: var(--muted); font-size: 0.85rem; }
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-text);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem;
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin: 14px 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head .hint { margin: 0; }

/* 状態と時計 */
.hero { text-align: center; padding: 22px 20px 18px; border-radius: 24px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 12px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 700; background: var(--line); color: var(--muted);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.working { background: var(--brand-tint); color: var(--brand-text); }
.status-pill.working .dot { background: var(--brand-fill); }
.status-pill.onBreak { background: var(--purple-tint); color: var(--purple-text); }
.status-pill.onBreak .dot { background: var(--purple-fill); }
.clock {
  margin: 4px 0 0; font-size: 4.25rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.since { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; justify-content: center; column-gap: 12px; }
.since span { white-space: nowrap; }
.daybar { margin-top: 14px; }
.daybar .track { position: relative; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.daybar .seg { position: absolute; top: 0; bottom: 0; }
.daybar .seg.work { background: var(--brand-fill); }
.daybar .seg.break { background: var(--purple-fill); }
.daybar .ticks { display: flex; justify-content: space-between; margin-top: 4px; font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 打刻のボタン: 2つなら横に並べる */
.actions { display: grid; gap: 12px; margin: 14px 0; }
.actions.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.button {
  appearance: none; border: 0; border-radius: 16px; padding: 18px 16px; font: inherit; font-size: 1.25rem; font-weight: 700;
  cursor: pointer; width: 100%; touch-action: manipulation; color: var(--text);
}
.button:disabled { opacity: 0.45; cursor: default; }
.button.punch { border-radius: 20px; min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.button .icon { display: inline-flex; }
.button.clockIn { background: var(--brand-fill); color: var(--on-brand); }
.button.clockOut { background: var(--amber-fill); color: var(--on-amber); }
.button.breakStart { background: var(--purple-fill); color: var(--on-purple); }
.button.breakEnd { background: var(--blue-fill); color: var(--on-blue); }
.button.secondary { background: var(--line); color: var(--text); font-size: 1rem; }
.row { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; margin-top: 12px; }
.pin {
  width: 100%; font: inherit; font-size: 2rem; letter-spacing: 0.5em; text-align: center; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text);
}
.hint { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.hint.small { margin-top: 10px; font-size: 0.8rem; }
.notice { background: var(--notice-tint); border-radius: 12px; padding: 12px; margin: 12px 0; }
.error { background: var(--error-tint); color: var(--error); border-radius: 12px; padding: 12px; margin: 12px 0; }
.warning h2 { color: var(--error); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; }
.badge { margin-left: 8px; font-size: 0.75rem; padding: 1px 8px; border-radius: 6px; background: var(--line); color: var(--muted); }
/* 反映待ち: アンバー (注意) の塗りに濃い同系色の文字。 */
.badge.pending { background: var(--amber-fill); color: var(--on-amber); }
footer { margin-top: 16px; color: var(--muted); font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
footer p { margin: 0; }
.link { appearance: none; border: 0; background: none; color: var(--brand-text); font: inherit; font-weight: 700; cursor: pointer; padding: 8px 0; }
.message { margin: 40px 0; text-align: center; color: var(--muted); }

/* 今日の打刻 (色の点で操作を見分ける) */
.timeline li { display: grid; grid-template-columns: 3.4em 14px 1fr auto; align-items: center; column-gap: 10px; border-top: 0; padding: 7px 0; }
.timeline .mark { width: 12px; height: 12px; border-radius: 50%; }
.mark.clockIn { background: var(--brand-fill); }
.mark.breakStart { background: var(--purple-fill); }
.mark.breakEnd { background: var(--blue-fill); }
.mark.clockOut { background: var(--amber-fill); }
.timeline .badge { margin-left: 0; }

/* 自分の勤怠 (今と前の締め期間) */
.segments { display: flex; gap: 4px; padding: 3px; margin: 4px 0 12px; border-radius: 10px; background: var(--line); }
.segment { flex: 1; border: 0; border-radius: 8px; padding: 8px 0; font: inherit; font-size: 0.9rem; background: transparent; color: var(--muted); cursor: pointer; }
.segment.selected { background: var(--brand-fill); color: var(--on-brand); font-weight: 700; }
.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 4px 0 10px; }
.totals > div { padding: 12px 14px; border-radius: 14px; background: var(--bg); }
.total-label { display: block; font-size: 0.8rem; color: var(--muted); }
.total-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.attendance li { display: grid; grid-template-columns: 5.2em 1fr auto; column-gap: 8px; align-items: baseline; }
.attendance .day { color: var(--muted); font-size: 0.9rem; }
.attendance .span, .attendance .work { font-variant-numeric: tabular-nums; }
.attendance .work { font-weight: 700; text-align: right; }
.attendance .notes { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.attendance .sub { font-size: 0.8rem; color: var(--muted); }
.attendance .badge { margin-left: 0; }
.more { font-size: 0.9rem; }

/* 有給休暇 (青 = 有給。申請の状態: 承認待ち = アンバーの縁、承認 = 青、差し戻し = 赤) */
.leave-summary { display: flex; align-items: center; gap: 16px; margin: 4px 0 14px; }
.leave-summary p { margin: 0; }
.ring {
  flex: none; width: 84px; height: 84px; border-radius: 50%; border: 8px solid var(--blue-fill);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.ring-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-unit { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.button.leave { background: var(--blue-fill); color: var(--on-blue); font-size: 1.05rem; padding: 14px 16px; border-radius: 14px; }
.button.small { font-size: 0.95rem; padding: 12px 14px; width: auto; }
.leave-form { margin: 4px 0 12px; }
.date-row { grid-template-columns: minmax(0, 1fr) auto; margin-top: 4px; align-items: center; }
.date-input {
  width: 100%; min-width: 0; font: inherit; font-size: 1rem; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text);
}
.date-chips { list-style: none; margin: 10px 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.date-chips li {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 999px;
  background: var(--blue-fill); color: var(--on-blue); font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
.date-chips .remove { appearance: none; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 0 6px; }
.field-label { margin: 10px 0 0; font-size: 0.8rem; color: var(--muted); }
.summary { margin: 0 0 8px; font-weight: 700; }
.leave-requests { margin-top: 8px; }
.leave-requests li { display: grid; grid-template-columns: 5.2em 1fr auto; column-gap: 8px; align-items: center; }
.leave-requests li:first-child { border-top: 1px solid var(--line); }
.leave-requests .day { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.leave-requests .notes, .leave-requests .inline-panel { grid-column: 1 / -1; }
.leave-requests .sub { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.leave-requests .link { padding: 2px 0; font-size: 0.9rem; }
.leave-requests .pin-panel { margin: 8px 0 4px; }
.chip { flex: none; font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.leave-pending { border-color: var(--amber-fill); color: var(--text); }
.chip.leave-approved { background: var(--blue-fill); border-color: var(--blue-fill); color: var(--on-blue); }
.chip.leave-rejected { background: var(--error-tint); border-color: var(--error-tint); color: var(--error); }
.chip.leave-cancelled { background: var(--line); }

/* シフト (確定 = 青の塗り、希望 = アンバーの縁、差し戻し = 赤)。ボタンは勤務の緑 */
.button.shift { background: var(--brand-fill); color: var(--on-brand); font-size: 1.05rem; padding: 14px 16px; border-radius: 14px; }
.shift-items { margin-top: 8px; }
.shift-items li { display: grid; grid-template-columns: 5.2em 1fr auto; column-gap: 8px; align-items: center; }
.shift-items li:first-child { border-top: 1px solid var(--line); }
.shift-items .day { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.shift-items .span { font-variant-numeric: tabular-nums; }
.shift-items .notes, .shift-items .inline-panel { grid-column: 1 / -1; }
.shift-items .sub { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.shift-items .link { padding: 2px 0; font-size: 0.9rem; }
.shift-items .pin-panel { margin: 8px 0 4px; }
.chip.shift-confirmed { background: var(--blue-fill); border-color: var(--blue-fill); color: var(--on-blue); }
.chip.shift-requested { border-color: var(--amber-fill); color: var(--text); }
.chip.shift-rejected { background: var(--error-tint); border-color: var(--error-tint); color: var(--error); }
.date-chips.shift li { background: var(--brand-fill); color: var(--on-brand); }
.weekday-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 4px 0 10px; }
.weekday {
  appearance: none; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font: inherit;
  font-size: 0.9rem; border-radius: 10px; padding: 8px 0; min-height: 40px; cursor: pointer;
}
.weekday.selected { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-brand); font-weight: 700; }
.bulk-add { margin-bottom: 6px; }
.bulk-add .button { width: 100%; }
.time-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 6px 0 10px; }
.time-field { display: flex; flex-direction: column; gap: 2px; }
.time-field .field-label { margin: 0; }

/* 同じ所属の人: 頭文字の丸と状態の色の縁 */
.colleagues { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 12px 8px; }
.colleagues li { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; text-align: center; }
.colleagues .face {
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--line); background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; color: var(--muted);
}
.colleagues .name { font-size: 0.8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.colleagues .state { font-size: 0.7rem; color: var(--muted); }
.colleagues .working .face { border-color: var(--brand-fill); background: var(--brand-tint); color: var(--brand-text); }
.colleagues .working .state { color: var(--brand-text); font-weight: 700; }
.colleagues .onBreak .face { border-color: var(--purple-fill); background: var(--purple-tint); color: var(--purple-text); }
.colleagues .onBreak .state { color: var(--purple-text); font-weight: 700; }
.colleagues .off .face { border-style: dashed; }

/* 広い画面 (パソコン・横向きのタブレット): 打刻と記録を左右に並べる */
.layout.single { max-width: 480px; margin: 0 auto; }
@media (min-width: 880px) {
  main { max-width: 1120px; padding: 28px 32px 48px; }
  header { margin: 0 0 6px; }
  .layout:not(.single) { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 28px; align-items: start; }
  .layout:not(.single) > .column:first-child { position: sticky; top: 16px; }
  .clock { font-size: 5rem; }
  .attendance li { padding: 8px 0; }
  .colleagues { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}
/* 右の列に余裕があるとき: 勤怠の1件を1行に (日付・時刻・休憩と修正・実働) */
@media (min-width: 1100px) {
  .attendance li { grid-template-columns: 7em 11em minmax(0, 1fr) 4.5em; }
  .attendance .notes { grid-column: 3; grid-row: 1; }
  .attendance .work { grid-column: 4; grid-row: 1; }
}
