/* Screens: login, top bar, department picker, department view, tabs, lists, calendar. */
.page > *, .toolbar > *, .att-row > *, .ctl, .ctl-main { min-width: 0; }

/* ---- Top bar ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.topbar-in { max-width: 1100px; margin: auto; display: flex; align-items: center; gap: .75rem; padding: 8px 16px; min-height: 68px; }
.topbar .grow { flex: 1; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; line-height: 1; color: var(--navy); }
.bar-title { font-size: 1.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name { color: var(--ink-2); display: none; }
.demo-badge { padding: 2px .7rem; border-radius: var(--r-pill); background: var(--amber-bg); color: var(--amber); font-size: .8125rem; font-weight: 700; }
@media (min-width: 720px) { .user-name { display: inline; } }

.page { max-width: 1100px; margin: auto; padding: 24px 16px calc(130px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) { .page { padding: 36px 24px 72px; } }

/* ---- Login ---- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 600px at 80% -10%, #3a35e8 0%, transparent 60%), radial-gradient(800px 600px at 0% 110%, #0568e7 0%, transparent 55%), linear-gradient(160deg, #0b1470, #050b3d); }
.login-sheet { width: min(430px, 100%); padding: 36px 30px 32px; display: grid; gap: 1.4rem; justify-items: center; text-align: center; box-shadow: var(--shadow-lg); border: 0; }
.brand-lg { display: grid; justify-items: center; gap: .35rem; }
.brand-lg .bird { width: 96px; height: auto; }
.brand-lg h1 { font-size: 3.2rem; color: var(--navy); }
.brand-lg p { color: var(--ink-2); }
.lead { color: var(--ink-2); max-width: 30ch; margin-inline: auto; }
#g-btn { display: flex; flex-direction: column; align-items: center; gap: .6rem; justify-content: center; min-height: 44px; }
.login-step { display: grid; gap: 1.1rem; justify-items: center; width: 100%; }
.login-step h2 { font-size: 1.5rem; }
.code-input { width: 100%; max-width: 280px; min-height: 64px; text-align: center; direction: ltr; font-size: 2rem; font-weight: 600; letter-spacing: .45em; padding-inline-start: .45em; font-variant-numeric: tabular-nums; }
.steps { text-align: start; margin: 0; padding-inline-start: 1.3rem; color: var(--ink-2); display: grid; gap: .3rem; }
.qr { background: #fff; padding: 10px; border-radius: 18px; line-height: 0; box-shadow: inset 0 0 0 1.5px var(--line); }
.qr svg { width: 188px; height: 188px; }
.secret { direction: ltr; display: inline-block; font: 500 .9rem/1.4 ui-monospace, Consolas, monospace; color: var(--ink-2); word-break: break-all; }
.check { display: flex; align-items: center; gap: .6rem; text-align: start; color: var(--ink-2); font-size: .9375rem; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; }
.error { color: var(--coral); min-height: 1.55em; font-weight: 600; }

/* ---- Department picker ---- */
.hello h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.hello p { margin-top: .5rem; color: var(--ink-2); font-size: 1.0625rem; }
.section-title { margin: 2rem 0 1rem; font-size: 1.4rem; }
.dep-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .dep-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .dep-grid { grid-template-columns: repeat(3, 1fr); } }
.dep-tile { display: grid; gap: 1.1rem; padding: 22px; text-align: start; color: inherit; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.dep-tile:hover { transform: translateY(-3px); box-shadow: 0 14px 34px -12px rgba(58, 53, 232, .35); }
.dep-tile h3 { font-size: 1.7rem; }
.dep-tile .mgr { color: var(--ink-2); }
.dep-top { display: flex; align-items: center; gap: 1rem; }
.logo { --s: 64px; flex: none; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.logo.mono { background: var(--grad-soft); color: var(--blue-d); font-family: var(--font-display); font-weight: 700; font-size: calc(var(--s) * .5); }
.prog { display: grid; gap: .5rem; color: var(--ink-2); font-size: .9375rem; }
.prog-bar { height: 8px; border-radius: 4px; background: #e6eaf6; overflow: hidden; }
.prog-bar i { display: block; height: 100%; border-radius: 4px; background: var(--grad); }
.prog .done { display: inline-flex; align-items: center; gap: .35rem; color: var(--ok); font-weight: 700; }

/* ---- Department view ---- */
.dep-head { display: flex; align-items: center; gap: 1.1rem; padding: 20px 24px; margin-bottom: 18px; color: #fff; border: 0; background: radial-gradient(500px 220px at 100% 0%, rgba(117, 34, 247, .55), transparent 70%), linear-gradient(135deg, #0a1a8c, #060f5a); }
.dep-head h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.dep-head p { color: #c9d3ff; }
.dep-head .logo { background: #fff; box-shadow: none; }

.tabs { display: flex; gap: 6px; padding: 6px; width: fit-content; margin-bottom: 18px; background: var(--surface); border-radius: var(--r-pill); box-shadow: var(--shadow); }
.tab { display: inline-flex; align-items: center; gap: .55rem; min-height: 46px; padding: 0 1.3rem; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2); font-weight: 500; transition: background-color .15s ease, color .15s ease; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--grad); color: #fff; font-weight: 600; }
@media (max-width: 719px) {
  .tabs { position: fixed; z-index: 30; inset-inline: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; margin: 0; gap: 4px; padding: 8px; box-shadow: var(--shadow-lg); }
  .tab { flex: 1; flex-direction: column; gap: .2rem; min-height: 58px; padding: 0 .2rem; border-radius: 20px; font-size: .75rem; line-height: 1.15; text-align: center; }
}

/* ---- Toolbar, summary ---- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 240px; }
.date-nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; width: 100%; }
.date-nav .date-title { flex: 1 1 8ch; min-width: 0; font-size: 1.3rem; text-align: center; }
.date-nav .date-input { flex: 1 1 100%; width: 100%; }
.date-input { color-scheme: light; }
@media (min-width: 720px) { .date-nav { width: auto; flex-wrap: nowrap; } .date-nav .date-title { flex: none; min-width: 12ch; font-size: 1.5rem; } .date-nav .date-input { flex: none; width: auto; } }

.summary { position: sticky; top: 68px; z-index: 10; display: grid; gap: .75rem; padding: 14px 18px; margin-bottom: 14px; }
.summary-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.summary-count { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; }
.summary-count small { font-family: var(--font-ui); font-weight: 400; font-size: .9375rem; color: var(--ink-2); }
.summary-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill { display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: 0 1rem; border: 0; border-radius: var(--r-pill); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--blue-d); font-weight: 600; }
.pill:hover:not(:disabled) { background: var(--surface-2); }
.pill[aria-pressed="true"] { background: var(--blue); color: #fff; box-shadow: none; }
.pill:disabled { opacity: .5; cursor: default; }
.filters { margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chips { flex-wrap: nowrap; width: max-content; }

/* ---- Lists inside one card ---- */
.rows { overflow: hidden; }
.row { padding: 16px 20px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-divider { padding: 10px 20px; background: var(--surface-2); color: var(--ink-2); font-size: .875rem; border-top: 1px solid var(--line); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; }
.who strong { font-size: 1.125rem; font-weight: 600; }
.att-row { display: grid; gap: 12px 24px; align-items: center; }
@media (min-width: 860px) { .att-row { grid-template-columns: minmax(180px, 1fr) minmax(0, 1.4fr); } }
.att-row.is-blocked .who strong { color: var(--ink-2); }
.att-row.is-done { box-shadow: inset -4px 0 0 var(--ok); }
.ctl { display: grid; gap: .6rem; }
.ctl-main { display: grid; gap: .5rem; }
.ctl .seg { display: flex; width: 100%; }
.ctl-extra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem 1rem; }
.note { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: .9375rem; }
.shmap { display: flex; }

.pick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .5rem 1rem; width: 100%; padding: 16px 20px; border: 0; border-top: 1px solid var(--line); background: transparent; color: inherit; text-align: start; transition: background-color .15s ease; }
.pick-row:first-child { border-top: 0; }
.pick-row:hover:not(:disabled) { background: var(--surface-2); }
.pick-row:disabled { opacity: .55; cursor: default; }
.pick-row .meta { color: var(--ink-2); font-size: .9375rem; }
.pick-row svg { color: var(--ink-3); }
.meta-line { color: var(--ink-2); font-size: .9375rem; display: flex; flex-wrap: wrap; gap: .2rem 1rem; align-items: center; }
.tel { display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; color: var(--blue-d); text-decoration: none; font-weight: 600; direction: ltr; }
.tel:hover { text-decoration: underline; }
.em-row { display: grid; gap: .8rem; }
.em-chips .chip { min-height: 44px; }

/* ---- Employee details sheet ---- */
.fields { display: grid; gap: 1.15rem; }
.ro { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--tap); padding: 0 1rem; border-radius: var(--r-ctrl); background: var(--surface-2); }
.ro svg { color: var(--ink-3); flex: none; }
.id-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.id-row .btn { flex: 1 1 auto; min-width: 0; padding-inline: .9rem; }
.id-row .ro { flex: 1 1 100%; direction: ltr; justify-content: flex-start; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.field-state { min-height: 1.2em; font-size: .875rem; color: var(--ink-2); }

/* ---- Calendar ---- */
.cal-wrap { padding: 18px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 14px; }
.cal-head h2 { font-size: 1.5rem; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; color: var(--ink-2); font-size: .875rem; padding-bottom: 4px; }
.cal-day { position: relative; min-height: 54px; border: 0; border-radius: var(--r-ctrl); background: var(--surface-2); color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; transition: background-color .15s ease; }
.cal-day:hover { background: #e8edfa; }
.cal-day.past { color: var(--ink-2); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--blue); font-weight: 700; }
.cal-day.blank { visibility: hidden; }
.cal-day .dot { position: absolute; bottom: 7px; inset-inline-start: 50%; width: 8px; height: 8px; margin-inline-start: -4px; border-radius: 50%; background: var(--ink-3); }
.cal-day .dot[data-k="present"], .legend i[data-k="present"] { background: var(--ok); }
.cal-day .dot[data-k="sick"], .legend i[data-k="sick"] { background: var(--amber); }
.cal-day .dot[data-k="comp"], .legend i[data-k="comp"] { background: var(--sky); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: 14px; color: var(--ink-2); font-size: .875rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }
.back-link { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1.1rem 0 .9rem; margin-bottom: 12px; border: 0; border-radius: var(--r-pill); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--blue-d); font-weight: 600; }

/* ---- Attendance v2: summary card, sections, one card per person ---- */
.summary { position: static; padding: 16px 18px; }
.summary-top { display: flex; align-items: center; gap: 1.6rem; }
.stat-block { display: grid; line-height: 1.15; }
.stat-block b { font-family: var(--font-display); font-size: 2rem; font-variant-numeric: tabular-nums; }
.stat-block span { color: var(--ink-2); font-size: .9375rem; }
.round-btn { position: relative; margin-inline-start: auto; display: inline-grid; place-items: center; width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--blue-d); box-shadow: inset 0 0 0 1.5px var(--line); }
.round-btn:hover { background: #e8edfa; }
.badge-dot { position: absolute; top: 8px; inset-inline-end: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 2px var(--surface); }
.sections { display: grid; gap: 22px; }
.att-section { display: grid; gap: 10px; }
.section-head { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; padding-inline: 4px; }
.section-head .count { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 .5rem; border-radius: var(--r-pill); background: var(--grad-soft); color: var(--blue-d); font-family: var(--font-ui); font-size: .875rem; font-weight: 700; }
.att-section.done .section-head .count { background: var(--ok-bg); color: var(--ok); }
.att-section.locked .section-head .count { background: var(--surface-2); color: var(--ink-2); }
.person { display: grid; gap: 14px; padding: 16px 18px; }
.person.is-blocked { background: var(--surface-2); box-shadow: none; }
.person-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.shifts { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.shift-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 54px; padding: 0 1.1rem; border: 0; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-weight: 600; transition: background-color .15s ease, color .15s ease, box-shadow .15s ease; }
.shift-btn:hover:not(:disabled) { background: var(--surface-2); }
.shift-btn[aria-pressed="true"] { background: var(--grad); color: #fff; box-shadow: 0 6px 14px -6px rgba(58, 53, 232, .6); }
.shift-btn:disabled { opacity: .45; cursor: default; }
@media (max-width: 400px) { .shift-btn { padding: 0 .7rem; gap: .35rem; } }
@media (min-width: 860px) { .person:not(.is-blocked) { grid-template-columns: minmax(200px, 1fr) minmax(0, 520px); align-items: center; } }

.ov-switch { padding-inline: .3rem .1rem; min-height: 54px; }

/* ---- Search bar with a filter button beside it ---- */
.search-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.search-row .search { flex: 1; min-width: 0; }
.search-row .round-btn { margin: 0; flex: none; }
.filter-panel { display: grid; gap: 1.4rem; }
.filter-group { display: grid; gap: .6rem; }
.filter-group h3 { font-size: 1.05rem; color: var(--ink-2); font-weight: 600; }
.filter-foot { display: grid; grid-template-columns: auto 1fr; gap: 10px; }

/* ---- Emergency tab ---- */
.status-badge { display: inline-flex; align-items: center; gap: .4rem; min-height: 30px; padding: 0 .8rem; border-radius: var(--r-pill); font-size: .875rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.status-badge[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.status-badge[data-tone="coral"] { background: var(--coral-bg); color: var(--coral); }
.status-badge[data-tone="sky"] { background: var(--sky-bg); color: var(--sky); }
.status-badge[data-tone="amber"] { background: var(--amber-bg); color: var(--amber); }
.status-badge[data-tone="lilac"] { background: var(--lilac-bg); color: var(--lilac); }
.em-select { display: flex; align-items: center; gap: .8rem; }
.em-select .select { flex: 1; }
@media (min-width: 860px) { .em-select .select { max-width: 340px; } }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%234a5379' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 1rem center; padding-inline-end: 1rem; padding-inline-start: 2.6rem; }

.person-link { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: start; color: inherit; cursor: pointer; min-height: 64px; transition: transform .15s ease, box-shadow .15s ease; }
.person-link:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -12px rgba(58, 53, 232, .35); }
.person-link svg { color: var(--ink-3); }

.confirm-text { color: var(--ink-2); font-size: 1.0625rem; line-height: 1.6; }
.id-edit { display: grid; gap: .6rem; }
.id-edit .input { direction: ltr; letter-spacing: .06em; }

.open-auth { display: flex; justify-content: center; text-decoration: none; }
.login .hint { color: var(--ink-3, #5b6477); font-size: .9rem; text-align: center; }
