:root {
  --bg: #f3f6fb;
  --surface: #fff;
  --surface-soft: #f7f9fc;
  --text: #172133;
  --muted: #68768a;
  --primary: #1f5eff;
  --primary-dark: #1747c7;
  --success: #168a66;
  --warning: #b66a08;
  --border: #d8e1ec;
  --shadow: 0 14px 34px rgba(31, 48, 74, .09);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: "Segoe UI", Arial, sans-serif; color: var(--text); background: linear-gradient(180deg, #eaf1fb 0, var(--bg) 34%, #f8fafc 100%); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(420px, 100%); padding: 30px; background: rgba(255,255,255,.97); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); }
.brand, .mini-brand { display: flex; align-items: center; gap: 13px; }
.brand { margin-bottom: 25px; }
.brand-mark { display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), #6590ff); font-weight: 800; }
.brand-mark { width: 52px; height: 52px; border-radius: 14px; font-size: 20px; }
.mini-mark { width: 42px; height: 42px; display: block; flex: 0 0 42px; object-fit: contain; }
.brand h1 { margin: 0; font-size: 22px; }
.brand p, .hint { color: var(--muted); }
.brand p { margin: 3px 0 0; font-size: 14px; }
.pin-label { display: block; margin-bottom: 8px; font-weight: 700; }
.pin-input { width: 100%; height: 58px; border: 1px solid var(--border); border-radius: 12px; background: #fbfdff; outline: none; text-align: center; font-size: 28px; font-weight: 700; letter-spacing: 12px; }
.pin-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(31,94,255,.1); }
.primary-btn { width: 100%; height: 50px; margin-top: 15px; border: 0; border-radius: 10px; color: #fff; background: var(--primary); font-weight: 800; }
.primary-btn:hover { background: var(--primary-dark); }
.hint { margin: 13px 0 0; text-align: center; font-size: 12px; }
.error { min-height: 18px; margin-top: 9px; text-align: center; color: #c83e3e; font-size: 13px; }

.topbar { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); }
.topbar-inner, .container { width: min(1200px, 100%); margin: auto; }
.topbar-inner { min-height: 66px; padding: 12px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mini-brand { font-size: 19px; font-weight: 750; }
.outline-btn { min-height: 38px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); font-weight: 700; }
.outline-btn:hover { border-color: #9db4cf; background: #f8fbff; }
.container { padding: 24px 22px 42px; }

.hero { padding: 20px 25px; display: flex; align-items: center; justify-content: space-between; gap: 22px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #173f92, #2d6bff); box-shadow: 0 17px 35px rgba(31,94,255,.2); text-transform: uppercase; }
.hero h2 { margin: 0; font-size: 28px; }
.hero h2 span { display: block; }
.hero h2 .schedule-period { margin-top: 5px; font-size: 22px; font-weight: 700; }
.eyebrow { margin: 0 0 5px; font-size: 10px; font-weight: 800; letter-spacing: .08em; color: rgba(255,255,255,.7); }
.eyebrow.dark { color: #68809a; }
.version-card { position: relative; min-width: 245px; padding: 15px 54px; border: 1px solid rgba(255,255,255,.22); border-radius: 13px; background: rgba(255,255,255,.13); text-align: center; }
.version-card span { display: block; color: rgba(255,255,255,.84); font-size: 13px; font-weight: 700; }
.version-card strong { display: block; margin-top: 7px; font-size: 17px; line-height: 1.15; text-transform: none; }
.refresh-btn { position: absolute; top: 50%; right: 14px; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; transform: translateY(-50%); border: 0; color: #fff; background: transparent; opacity: .88; }
.refresh-btn span { color: currentColor; font-size: 27px; line-height: 1; font-weight: 400; }
.refresh-btn:hover { opacity: 1; }
.refresh-btn:active { transform: translateY(-50%) rotate(25deg); }

.tabs { display: flex; gap: 9px; margin: 20px 0; overflow-x: auto; }
.tab { padding: 11px 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-weight: 650; white-space: nowrap; }
.tab.active { border-color: var(--primary); color: #fff; background: var(--primary); }
.toolbar { margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.employee-filter { position: relative; min-width: min(360px, 100%); min-height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.employee-filter > span { color: #6686a7; font-size: 18px; }
.control { width: 100%; min-height: 42px; border: 0; outline: 0; color: var(--text); background: transparent; }
.employee-filter .control { padding-right: 54px; }
.filter-clear { position: absolute; right: 31px; top: 50%; z-index: 1; width: 25px; height: 25px; padding: 0; display: grid; place-items: center; transform: translateY(-50%); border: 0; border-radius: 6px; color: #66778b; background: #edf2f7; font-size: 19px; line-height: 1; }
.filter-clear:hover { color: #24364a; background: #e0e8f1; }
.filter-clear:active { transform: translateY(-50%) scale(.96); }
.schedule-metrics { margin-bottom: 16px; display: grid; grid-template-columns: repeat(4, minmax(145px, 1fr)); gap: 10px; }
.metric-card { position: relative; min-height: 76px; padding: 14px 16px; display: flex; align-items: flex-start; justify-content: space-between; flex-direction: column; overflow: hidden; border: 1px solid #d2deea; border-radius: 12px; background: #fff; box-shadow: 0 6px 18px rgba(31,63,91,.055); }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #4a8fcb; }
.metric-card strong { display: inline-block; color: #10283f; font-size: 24px; line-height: 1; font-weight: 850; }
.metric-card span { margin-left: 2px; color: #7590aa; font-size: 12px; font-weight: 750; }
.metric-card small { color: #68829b; font-size: 9px; line-height: 1.25; font-weight: 750; letter-spacing: .025em; }
.metric-employees::before { background: #2ea7c9; }
.metric-month-days::before { background: #6f87d7; }
.metric-work-days::before { background: #49a879; }

.panel { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 10px 26px rgba(16,24,40,.045); }
.panel-head { padding: 17px 19px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; font-size: 18px; }
.schedule-panel-head { position: relative; min-height: 62px; padding: 17px 20px; justify-content: center; text-align: center; }
.schedule-panel-head h3 { font-size: 22px; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 13px; }
.days-list { padding: 15px; display: grid; gap: 14px; }
.day-card { overflow: hidden; border: 1px solid #9fb7cc; border-radius: 14px; background: #cfdeeb; box-shadow: 0 6px 16px rgba(42,72,102,.09); }
.day-header { padding: 14px 16px; display: flex; align-items: center; gap: 12px; background: #b7cde0; list-style: none; cursor: pointer; user-select: none; }
.day-header::-webkit-details-marker { display: none; }
.day-header::after { content: "⌄"; margin-left: auto; color: #49657e; font-size: 21px; line-height: 1; transition: transform .16s ease; }
.day-card[open] .day-header { border-bottom: 1px solid #9db6cc; }
.day-card[open] .day-header::after { transform: rotate(180deg); }
.day-header strong { display: block; font-size: 16px; }
.day-header small { display: block; margin-top: 3px; color: var(--muted); }
.shift-columns { padding: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: #cfdeeb; }
.shift-block { overflow: hidden; border: 1px solid #cfdbe7; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(28,55,83,.055); }
.shift-block.first, .shift-block.second { background: #fff; }
.shift-head { min-height: 52px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #cbd9e7; }
.shift-block.first .shift-head { background: #e5effc; }
.shift-block.second .shift-head { background: #eee9fa; }
.shift-head > strong { font-size: 17px; line-height: 1; font-weight: 850; }
.shift-badge, .time-badge, .absence-badge, .external-badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.shift-badge { padding: 6px 10px; font-size: 16px; line-height: 1; font-weight: 850; text-transform: uppercase; }
.shift-badge.first { color: #2057d4; background: #e8f0ff; }
.shift-badge.second { color: #6941c6; background: #eee9ff; }
.workers { padding: 5px 12px; }
.worker-row { min-height: 42px; padding: 9px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #edf1f5; transition: opacity .18s, background .18s; }
.worker-row:last-child { border-bottom: 0; }
.worker-name { font-weight: 750; }
.worker-meta { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.time-badge { color: #186c52; background: #e3f7ef; }
.absence-badge { min-width: 30px; height: 28px; padding: 0 7px; justify-content: center; border-radius: 5px; color: #0a1525; font-size: 12px; }
.absence-badge.absence-go { background: #d9d900; }
.absence-badge.absence-bo,
.absence-badge.absence-po,
.absence-badge.absence-sl,
.absence-badge.absence-pr { background: #9fb4cd; }
.absence-badge.absence-other { color: #4d6075; background: #e3eaf2; }
.external-badge { color: #276783; background: #e1f3fa; }
.worker-row.dimmed { opacity: .28; }
.worker-row.highlighted { margin: 2px -7px; padding-left: 7px; padding-right: 7px; border-radius: 8px; background: #eaf2ff; box-shadow: inset 3px 0 var(--primary); opacity: 1; }
.empty-shift { padding: 14px 0; color: #98a3b3; font-size: 12px; }
.day-extras { padding: 0 13px 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: #cfdeeb; }
.day-extra { overflow: hidden; border: 1px solid #cfdbe7; border-radius: 10px; background: #fff; }
.day-extra summary { min-height: 43px; padding: 9px 12px; display: flex; align-items: center; gap: 9px; color: #536a82; background: #f7f9fc; font-size: 12px; font-weight: 750; list-style: none; cursor: pointer; user-select: none; }
.day-extra summary::-webkit-details-marker { display: none; }
.day-extra summary::after { content: "⌄"; margin-left: 1px; color: #7890aa; font-size: 18px; line-height: 1; transition: transform .16s ease; }
.day-extra[open] summary { border-bottom: 1px solid #dbe4ee; }
.day-extra[open] summary::after { transform: rotate(180deg); }
.day-extra-count { min-width: 25px; height: 25px; margin-left: auto; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; color: #37526d; background: #e5edf6; font-size: 12px; font-weight: 800; }
.day-extra.free-day summary { background: #f5f8fb; }
.day-extra.absences summary { background: #f5f3fa; }
.notice { margin-top: 15px; padding: 13px 15px; border: 1px solid #eed8a2; border-radius: 12px; color: #765117; background: #fff8e8; font-size: 13px; }

.vacation-panel-head { min-height: 64px; align-items: center; justify-content: center; background: #fbfcfe; text-align: center; }
.vacation-panel-head h3 { font-size: 18px; text-transform: uppercase; }
.vacation-toolbar { margin-bottom: 15px; }
.vacation-summary { margin: -3px 0 15px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vacation-summary-card { min-height: 86px; padding: 14px 16px; display: flex; align-items: center; justify-content: center; flex-direction: column; border: 1px solid #c9d8e6; border-radius: 12px; background: #fff; box-shadow: 0 4px 12px rgba(42,72,102,.06); text-align: center; }
.vacation-summary-card span { color: #647d95; font-size: 10px; line-height: 1.25; font-weight: 800; letter-spacing: .025em; }
.vacation-summary-card strong { margin-top: 7px; color: #1b5f9a; font-size: 26px; line-height: 1; font-weight: 850; }
.vacation-summary-card.used strong { color: #b67414; }
.vacation-summary-card.remaining strong { color: #25845b; }
.vacation-summary-empty { grid-column: 1 / -1; min-height: 66px; padding: 16px; display: flex; align-items: center; justify-content: center; border: 1px dashed #b6c6d6; border-radius: 12px; color: #63788d; background: rgba(255,255,255,.72); font-size: 13px; text-align: center; }
.vacation-list { padding: 16px; display: grid; gap: 18px; background: #eef3f8; }
.vacation-filter-empty { min-height: 110px; padding: 22px; display: flex; align-items: center; justify-content: center; border: 1px dashed #b6c6d6; border-radius: 12px; color: #63788d; background: rgba(255,255,255,.62); font-size: 13px; text-align: center; }
.vacation-month { overflow: hidden; border: 1px solid #9fb7cc; border-radius: 14px; background: #cfdeeb; box-shadow: 0 6px 16px rgba(42,72,102,.09); }
.vacation-month-head { min-height: 55px; padding: 13px 16px; display: flex; align-items: center; gap: 12px; background: #b7cde0; list-style: none; cursor: pointer; user-select: none; }
.vacation-month-head::-webkit-details-marker { display: none; }
.vacation-month-head::after { content: "⌄"; margin-left: auto; color: #49657e; font-size: 21px; line-height: 1; transition: transform .16s ease; }
.vacation-month[open] .vacation-month-head { border-bottom: 1px solid #9db6cc; }
.vacation-month[open] .vacation-month-head::after { transform: rotate(180deg); }
.vacation-month-head h4 { margin: 0; color: #18334e; font-size: 17px; }
.vacation-cards { padding: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; background: #cfdeeb; }
.vacation-month-empty { grid-column: 1 / -1; min-height: 72px; padding: 18px; display: flex; align-items: center; justify-content: center; border: 1px dashed #aebfd0; border-radius: 10px; color: #63788d; background: rgba(255,255,255,.52); font-size: 13px; text-align: center; }
.vacation-card { min-width: 0; padding: 13px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 11px 14px; border: 1px solid #d6e0e9; border-left: 4px solid #6a9bc8; border-radius: 11px; background: #fbfcfe; }
.vacation-period { min-width: 0; grid-column: 1; grid-row: 1; }
.vacation-period small, .vacation-person small { display: block; color: #71859a; font-size: 9px; font-weight: 800; letter-spacing: .025em; }
.vacation-period strong { display: block; margin-top: 4px; color: #16324e; font-size: 14px; }
.vacation-person { min-width: 0; grid-column: 1; grid-row: 2; align-self: center; }
.vacation-person strong { display: block; overflow: hidden; color: #182b3f; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.vacation-person small { margin-top: 4px; font-size: 11px; }
.vacation-status { min-width: 92px; min-height: 31px; padding: 6px 9px; display: inline-flex; grid-column: 2; grid-row: 1; align-self: center; justify-self: end; align-items: center; justify-content: center; border-radius: 8px; font-size: 10px; line-height: 1; font-weight: 850; white-space: nowrap; }
.vacation-status.reserved { color: #315f9c; background: #e4edfb; }
.vacation-status.active { color: #17694f; background: #ddf3e9; }
.vacation-status.used { color: #5f6e7e; background: #e8edf2; }
.vacation-duration { min-width: 92px; min-height: 58px; padding: 8px 11px; display: flex; grid-column: 2; grid-row: 2; align-self: center; justify-self: end; align-items: center; justify-content: center; flex-direction: column; border-radius: 9px; color: #205d92; background: #e4f0fa; white-space: nowrap; }
.vacation-duration strong { font-size: 23px; line-height: 1; font-weight: 850; }
.vacation-duration small { margin-top: 5px; font-size: 9px; line-height: 1; font-weight: 850; }
.data-error { margin-top: 16px; padding: 14px; border: 1px solid #efb4b4; border-radius: 12px; color: #9f2f2f; background: #fff0f0; }

@media (max-width: 780px) {
  .topbar-inner, .container { padding-left: 14px; padding-right: 14px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero > div:first-child { width: 100%; text-align: center; }
  .hero h2 { font-size: 23px; }
  .version-card { width: 100%; min-width: 0; }
  .tabs { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab { width: 100%; padding-left: 8px; padding-right: 8px; font-size: 14px; text-align: center; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .employee-filter { width: 100%; min-width: 0; }
  .schedule-metrics { grid-template-columns: repeat(2, 1fr); }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .vacation-panel-head { align-items: center; justify-content: center; }
  .vacation-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .vacation-summary-card { min-height: 78px; padding: 11px 5px; }
  .vacation-summary-card span { font-size: 8px; }
  .vacation-summary-card strong { font-size: 23px; }
  .schedule-panel-head { min-height: 60px; padding-left: 14px; padding-right: 14px; align-items: center; justify-content: center; flex-direction: row; }
  .schedule-panel-head h3 { font-size: 17px; }
  .shift-columns { grid-template-columns: 1fr; }
  .day-extras { grid-template-columns: 1fr; }
  .vacation-list { padding: 10px; gap: 14px; }
  .vacation-month-head { padding-left: 13px; padding-right: 13px; }
  .vacation-cards { padding: 10px; grid-template-columns: 1fr; }
}
