/* myCalendary — palette A "Aegean & pomegranate". Mobile first; two columns from 900px. */

@font-face {
  font-family: 'Commissioner';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/commissioner-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Commissioner';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/commissioner-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Commissioner';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/commissioner-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

:root,
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --ink: #1A2838;
  --muted: #5D6B7C;
  --line: #DCE3EC;
  --field: #C5D0DD;
  --weekend: #E8EDF4;
  --leave: #1E5FA8;
  --on-leave: #FFFFFF;
  --leave-soft: #D5E3F5;
  --holiday: #B8324F;
  --holiday-soft: #F6DCE2;
  --warn: #A45A00;
  --warn-soft: #FDF0DC;
  --ok: #2E7D4F;
  --focus: #1E5FA8;
  --shadow: 0 10px 30px rgba(26, 40, 56, 0.18);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #10161E;
  --surface: #18212C;
  --ink: #E5ECF3;
  --muted: #93A1B2;
  --line: #2A3644;
  --field: #3A4858;
  --weekend: #1C2733;
  --leave: #6FA8EE;
  --on-leave: #0B1A2C;
  --leave-soft: #22384F;
  --holiday: #F07A92;
  --holiday-soft: #47222C;
  --warn: #F2B35B;
  --warn-soft: #3A2A12;
  --ok: #6CCB94;
  --focus: #9CC4F5;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Commissioner', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--leave); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { padding: 0; list-style: none; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.hint { font-size: 13.5px; color: var(--muted); }
.loading, .load-error { max-width: 40rem; margin: 20vh auto 0; padding: 0 16px; text-align: center; color: var(--muted); }
.load-error .btn { margin-top: 12px; }

/* ---------- Buttons and inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-size: 14.5px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--field); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--leave); border-color: var(--leave); color: var(--on-leave); }
.btn.danger { color: var(--holiday); border-color: color-mix(in srgb, var(--holiday) 40%, var(--line)); }
.btn.danger-solid { background: var(--holiday); border-color: var(--holiday); color: var(--surface); }
.btn.link { min-height: 0; padding: 0; border: none; background: none; color: var(--leave); font-weight: 500; text-decoration: underline; }
.btn-small { min-height: 34px; padding: 5px 11px; font-size: 13.5px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid transparent; border-radius: 10px; background: none; font-size: 22px; line-height: 1; cursor: pointer;
}
.icon-btn.round { border-radius: 50%; border-color: var(--line); background: var(--surface); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.chip {
  padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--field);
  background: var(--surface); color: var(--leave); font-size: 13.5px; cursor: pointer;
}

input[type='text'], input[type='number'], textarea, select {
  width: 100%; min-height: 42px; padding: 8px 11px;
  border: 1px solid var(--field); border-radius: 10px; background: var(--surface);
  font-size: 16px; /* 16px stops iOS zooming into fields */
}
textarea { resize: vertical; min-height: 64px; }
input:disabled, textarea:disabled { background: var(--weekend); color: var(--muted); cursor: not-allowed; opacity: 0.7; }
select { width: auto; padding-right: 28px; }

.field { display: grid; gap: 4px; }
.field label { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); }
.counter { font-variant-numeric: tabular-nums; }
.form { display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row input[type='text'] { flex: 1; width: auto; min-width: 0; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--weekend); }
.seg button { border: none; background: none; padding: 7px 13px; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.seg-small button { padding: 5px 10px; font-size: 13px; }

.switch {
  flex: none; position: relative; width: 46px; height: 28px; border-radius: 14px;
  border: none; background: var(--field); cursor: pointer;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s;
}
.switch[aria-checked='true'] { background: var(--leave); }
.switch[aria-checked='true']::after { transform: translateX(18px); }

.error-box, .warning {
  padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
}
.error-box ul, .warning ul { margin-top: 6px; display: grid; gap: 4px; }
.warning p + p { margin-top: 10px; }
.ok-text { color: var(--ok); font-size: 14px; }

/* ---------- Signed-out page ---------- */

.welcome { max-width: 36rem; margin: 0 auto; padding: 20px 16px 32px; min-height: 100vh; display: flex; flex-direction: column; }
.welcome-head { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.brand svg { width: 22px; height: 22px; color: var(--leave); }
.welcome-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 6vh 0; }
.welcome h1 { font-size: clamp(28px, 6.5vw, 40px); line-height: 1.12; letter-spacing: -0.025em; font-weight: 700; max-width: 18em; }
.welcome-points { display: grid; gap: 10px; }
.welcome-points li { position: relative; padding-left: 26px; color: var(--muted); }
.welcome-points li::before {
  content: ''; position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 4px; background: var(--leave);
}
.welcome-points li:nth-child(2)::before {
  background: repeating-linear-gradient(135deg, var(--holiday-soft) 0 3px, transparent 3px 5px), var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--holiday);
}
.welcome-points li:nth-child(3)::before { background: var(--leave-soft); }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; }
.welcome-foot { font-size: 14px; }

/* Google sign-in button (Google branding: white, "G" logo, 1px border) */
.google-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 16px 0 12px; border-radius: 22px;
  background: #FFFFFF; border: 1px solid #747775; color: #1F1F1F;
  font-family: 'Roboto', 'Commissioner', system-ui, sans-serif; font-size: 15px; font-weight: 500; text-decoration: none;
}
.google-btn:hover { background: #F7F8F8; }
.google-g { width: 20px; height: 20px; }

/* ---------- Signed-in frame ---------- */

.app-head {
  max-width: 1180px; margin: 0 auto; padding: 16px 16px 6px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.hello { font-size: clamp(20px, 5vw, 26px); font-weight: 650; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.app-head nav { display: flex; gap: 16px; }
.tab { color: var(--muted); text-decoration: none; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.tab[aria-current='page'] { color: var(--ink); font-weight: 600; border-bottom-color: var(--leave); }
.view { max-width: 1180px; margin: 0 auto; padding: 8px 16px 40px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.card h2 { font-size: 16.5px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 8px; }

/* ---------- Calendar ---------- */

.calendar-layout { display: grid; gap: 16px; }
.calendar-main { display: grid; gap: 10px; align-content: start; }
.calendar-side { display: flex; flex-direction: column; gap: 12px; }
.calendar-side .legend { order: -1; } /* phone: legend right under the grid */

.toolbar { display: flex; align-items: center; gap: 8px; }
.toolbar-title { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; }
.toolbar h1 { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.toolbar select { min-height: 36px; padding: 4px 26px 4px 10px; font-size: 15px; }

.banner {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent); font-weight: 600;
}
.range-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 12px;
  border-radius: 10px; background: var(--leave-soft); font-size: 14.5px;
}

.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }

.day {
  --hol-ring: 0 0 #0000;
  --today-ring: 0 0 #0000;
  position: relative; aspect-ratio: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid transparent; border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-size: 15px; font-variant-numeric: tabular-nums; cursor: pointer;
  box-shadow: var(--today-ring), var(--hol-ring);
}
.day:hover { border-color: var(--field); }
.day .label { display: none; }
.day .note { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.85; }

.day.weekend { background: var(--weekend); color: var(--muted); }
.day.holiday {
  --hol-ring: inset 0 0 0 1.5px var(--holiday);
  background: repeating-linear-gradient(135deg, var(--holiday-soft) 0 6px, transparent 6px 10px), var(--surface);
  color: var(--holiday); font-weight: 650;
}
.day.leave { background: var(--leave); color: var(--on-leave); font-weight: 600; }
.day.leave-zero { background: var(--leave-soft); color: var(--leave); font-weight: 600; }
.day.holiday.leave-zero {
  background: repeating-linear-gradient(135deg, var(--holiday-soft) 0 6px, transparent 6px 10px), var(--leave-soft);
}
.day.problem { background: var(--warn-soft); color: var(--ink); border: 2px dashed var(--warn); font-weight: 600; }
.day.today { --today-ring: inset 0 0 0 3px var(--ink); font-weight: 700; }
.day.leave.today { --today-ring: inset 0 0 0 3px var(--on-leave), 0 0 0 2px var(--ink); }
.day.range-start { outline: 3px solid var(--leave); outline-offset: 2px; }
.blank { aspect-ratio: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.key { flex: none; display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.key.leave { background: var(--leave); }
.key.leave-zero { background: var(--leave-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--leave) 35%, transparent); }
.key.holiday {
  background: repeating-linear-gradient(135deg, var(--holiday-soft) 0 3px, transparent 3px 5px), var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--holiday);
}
.key.weekend { background: var(--weekend); box-shadow: inset 0 0 0 1px var(--line); }
.key.today { box-shadow: inset 0 0 0 2px var(--ink); }
.key.problem { background: var(--warn-soft); border: 1.5px dashed var(--warn); }
.key.with-holiday { box-shadow: inset 0 0 0 1.5px var(--holiday); }

.balances { display: grid; gap: 10px; }
.balance-year { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.balance-main { display: flex; align-items: baseline; gap: 8px; }
.balance-main strong { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; color: var(--leave); font-variant-numeric: tabular-nums; }
.balance-main span { color: var(--muted); font-size: 14.5px; }
.balance-period { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.balance-ended { font-size: 13px; color: var(--muted); margin-top: 8px; }
.bar { height: 6px; border-radius: 3px; background: var(--leave-soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--leave); border-radius: 3px; }
.balance.missing { display: grid; gap: 10px; justify-items: start; border-style: dashed; }

.month-list ul { display: grid; gap: 2px; }
.month-item {
  width: 100%; display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: start; text-align: left;
  padding: 7px 6px; border: none; border-radius: 8px; background: none; cursor: pointer; font-size: 14px;
}
.month-item:hover { background: var(--bg); }
.month-item .key { margin-top: 3px; }
.month-item .what { display: grid; gap: 1px; min-width: 0; }
.month-item b { font-weight: 600; }
.month-item .line { color: var(--muted); overflow-wrap: anywhere; }

/* ---------- Dialogs: bottom sheet on phones, centred dialog on wider screens ---------- */

dialog.sheet {
  width: 100%; max-width: 100%; max-height: 88vh; margin: auto 0 0; padding: 0;
  border: none; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(10, 18, 28, 0.45); }
.sheet-inner { padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet-title { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.sheet-body { display: grid; gap: 14px; }
.sheet-text { color: var(--ink); }
.sheet-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.sheet-actions.spread { justify-content: space-between; }
.choice { display: grid; gap: 8px; }
.mark { display: grid; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); }
.mark h3 { font-size: 15.5px; font-weight: 650; }
.mark-leave { border-left: 4px solid var(--leave); }
.mark-holiday { border-left: 4px solid var(--holiday); }
.mark-problem { border-left-color: var(--warn); }
.mark .status { font-size: 14px; color: var(--muted); }
.range-dates { font-weight: 600; }
.problems ul { display: grid; gap: 8px; margin-top: 6px; }

@media (min-width: 640px) {
  dialog.sheet { width: min(480px, 92vw); margin: auto; border-radius: 16px; }
  .choice { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

/* ---------- Tooltip and toast ---------- */

.tooltip {
  position: fixed; z-index: 10; max-width: 260px; padding: 8px 10px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.4; white-space: pre-line;
  pointer-events: none; opacity: 0; transition: opacity 0.12s;
}
.tooltip.show { opacity: 1; }
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: 20px; transform: translate(-50%, 20px);
  padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 14.5px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Profile ---------- */

.profile-layout, .profile-layout .col { display: grid; gap: 12px; align-content: start; }
.year-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.year-picker button {
  padding: 7px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); cursor: pointer; display: grid; line-height: 1.2;
}
.year-picker small { font-size: 11.5px; }
.year-picker button[aria-pressed='true'] { border-color: var(--leave); background: var(--leave-soft); color: var(--leave); font-weight: 650; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
#period-end { max-width: 170px; }
#period-allowance { max-width: 110px; }
.summary { display: flex; gap: 20px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.summary dt { font-size: 13px; color: var(--muted); }
.summary dd { margin: 0; font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; }
.summary .left dd { color: var(--leave); }
.summary dd.small { font-size: 15px; padding-top: 5px; }
.plain-list { display: grid; gap: 6px; margin-bottom: 6px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--warn); }
.dot.muted { background: var(--field); }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: none; padding-top: 0; }
.card > .row, .card > .hint + .row { margin-top: 8px; }
.card > p + p { margin-top: 8px; }

/* ---------- PC: two columns, bigger day cells with text ---------- */

@media (min-width: 900px) {
  .app-head { padding: 22px 28px 10px; }
  .view { padding: 10px 28px 48px; }
  .calendar-layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; }
  .calendar-side .legend { order: 3; }
  .grid { gap: 6px; }
  .day {
    aspect-ratio: auto; min-height: 92px; padding: 8px; align-items: stretch; justify-content: flex-start; text-align: left;
  }
  .day .num { font-size: 15px; }
  .day .label {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin-top: 4px; font-size: 12px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere;
  }
  .day .note { top: 9px; right: 9px; bottom: auto; }
  .blank { aspect-ratio: auto; }
  .profile-layout { grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
