:root {
  --ink: #173334;
  --muted: #6f8181;
  --line: #dce6e4;
  --canvas: #f4f7f6;
  --surface: #ffffff;
  --brand: #176b68;
  --brand-dark: #104f4d;
  --brand-soft: #dff1ed;
  --blue-soft: #e5eef7;
  --sand-soft: #f6eddb;
  --danger: #c24d4d;
  --danger-soft: #fde9e7;
  --warning: #a66b15;
  --warning-soft: #fff1d4;
  --shadow: 0 18px 50px rgba(20, 55, 54, .09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 760; letter-spacing: -.3px; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; background: var(--brand); color: white; font-size: 24px; font-weight: 400; line-height: 1; }
.brand-light .brand-mark { color: var(--brand-dark); background: white; }
.mobile-brand { display: none; margin-bottom: 56px; }
.eyebrow { margin: 0 0 8px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(400px, 48%) 1fr; background: white; }
.login-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px clamp(44px, 6vw, 96px); color: white; background: linear-gradient(145deg, #123c3d 0%, #176d69 72%, #1d7e77 100%); }
.login-story::before, .login-story::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; }
.login-story::before { width: 520px; height: 520px; right: -280px; top: -170px; }
.login-story::after { width: 360px; height: 360px; left: -200px; bottom: -170px; }
.story-copy { position: relative; z-index: 1; max-width: 600px; margin: 11vh 0 8vh; }
.story-copy .eyebrow { color: #a8ded4; }
.story-copy h1 { margin: 0 0 24px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 5vw, 76px); font-weight: 400; line-height: 1.02; letter-spacing: -2.5px; }
.story-copy > p:last-child { max-width: 520px; margin: 0; color: rgba(255,255,255,.74); font-size: 17px; line-height: 1.65; }
.story-card { position: relative; z-index: 1; display: flex; align-items: center; gap: 24px; width: fit-content; padding: 18px 22px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.09); backdrop-filter: blur(10px); }
.story-card strong, .story-card small { display: block; }
.story-card small { margin-top: 5px; color: rgba(255,255,255,.66); }
.story-days { display: flex; gap: 5px; }
.story-days span { display: grid; place-items: center; width: 34px; height: 38px; border-radius: 9px; color: rgba(255,255,255,.66); background: rgba(255,255,255,.08); font-size: 12px; }
.story-days span.accent { color: var(--brand-dark); background: white; font-weight: 800; transform: translateY(-5px); box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; }
.login-form { width: min(420px, 100%); }
.login-form h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 42px; font-weight: 400; letter-spacing: -1.2px; }
.form-intro { margin: 14px 0 34px; color: var(--muted); line-height: 1.55; }
label { display: block; margin-bottom: 20px; font-size: 13px; font-weight: 720; }
input, select, textarea { width: 100%; margin-top: 9px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: white; color: var(--ink); transition: border-color .18s, box-shadow .18s; }
input, select { height: 48px; padding: 0 14px; }
textarea { resize: vertical; min-height: 86px; padding: 13px 14px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,107,104,.11); }
input::placeholder, textarea::placeholder { color: #a4b0af; }
.form-error { min-height: 20px; margin: -7px 0 13px; color: var(--danger); font-size: 13px; line-height: 1.4; }
.login-help { max-width: 420px; margin: 40px 0 0; color: #92a09f; font-size: 12px; line-height: 1.5; text-align: center; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: 13px; font-weight: 750; transition: transform .15s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { color: white; background: var(--brand); box-shadow: 0 7px 18px rgba(23,107,104,.18); }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary { border-color: var(--line); background: white; }
.button-secondary:hover { border-color: #aebfbd; }
.button-danger { color: var(--danger); background: var(--danger-soft); }
.button-wide { width: 100%; min-height: 50px; }
.button-small { min-height: 36px; padding: 0 14px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: white; font-size: 18px; }
.icon-button:hover { border-color: #adc0bd; background: #f9fbfa; }
.icon-text-button { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 11px; border: 0; border-radius: 9px; cursor: pointer; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.icon-text-button:hover { background: #edf3f1; color: var(--ink); }

.app { min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 70px; padding: 0 clamp(20px, 4vw, 64px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(16px); }
.top-actions, .user-block { display: flex; align-items: center; }
.top-actions { gap: 15px; }
.user-block { gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.user-block strong, .user-block small { display: block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-block strong { font-size: 12px; }
.user-block small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.main-content { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 46px 0 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.page-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 4vw, 48px); font-weight: 400; letter-spacing: -1.4px; }
.page-heading > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.page-heading-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.production-calendar-link { color: var(--brand-dark); text-decoration: none; }

.calendar-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow); }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 76px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.month-navigation { display: flex; align-items: center; gap: 9px; }
.month-picker-shell { position: relative; }
.month-picker-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 190px; min-height: 40px; padding: 0 11px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; background: transparent; font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 400; text-transform: capitalize; }
.month-picker-button:hover, .month-picker-button[aria-expanded="true"] { border-color: var(--line); background: #f7faf9; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { min-height: 38px; border-bottom: 1px solid var(--line); background: #f9fbfa; }
.weekdays span { display: flex; align-items: center; padding-left: 11px; color: #879795; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.calendar-grid { background: var(--line); gap: 1px; }
.day { position: relative; min-width: 0; min-height: 138px; padding: 9px; border: 0; cursor: pointer; overflow: hidden; background: white; text-align: left; vertical-align: top; }
.day:hover { z-index: 1; background: #fbfdfc; box-shadow: inset 0 0 0 2px var(--brand-soft); }
.calendar-grid.drag-selecting, .calendar-grid.drag-selecting * { cursor: grabbing !important; user-select: none; }
.calendar-grid.drag-selecting { touch-action: none; }
.day.outside { background: #f8faf9; }
.day.outside .day-number, .day.outside .occupancy { opacity: .38; }
.day.weekend { background-image: linear-gradient(rgba(247,250,249,.5),rgba(247,250,249,.5)); }
.day.today .day-number { color: white; background: var(--brand); }
.day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.day-number { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; font-size: 12px; font-weight: 750; }
.occupancy { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.05; text-align: right; }
.occupancy-line { display: block; white-space: nowrap; }
.occupancy::before { display: none; }
.day.near .occupancy { color: var(--warning); }.day.near .occupancy::before { background: #e6b761; }
.day.full .occupancy { color: var(--danger); }.day.full .occupancy::before { background: #de8179; }
.vacation-chip { display: flex; align-items: center; width: 100%; margin-top: 2px; padding: 2px 5px; border: 0; border-left: 3px solid #84bdb4; border-radius: 5px; overflow: hidden; cursor: default; background: #edf7f4; color: #315c58; font-size: 10px; font-weight: 680; line-height: 1.2; text-align: left; white-space: nowrap; }
.vacation-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5px; margin-top: 2px; }
.vacation-column { min-width: 0; }
.vacation-column.others { padding-left: 5px; border-left: 1px solid #e4ecea; }
.vacation-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vacation-chip.more { display: block; }
.vacation-chip.own { border-left-color: var(--brand); background: #dff1ed; color: var(--brand-dark); cursor: pointer; }
.vacation-chip.editable { cursor: pointer; }
.vacation-chip.more { border-left-color: #c4cfcd; background: #f2f5f4; color: var(--muted); }
.calendar-tip { display: flex; align-items: center; gap: 8px; margin: 15px 4px 0; color: var(--muted); font-size: 11px; }
.calendar-tip span { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid #b7c6c4; border-radius: 50%; font-family: Georgia, serif; font-weight: 700; }
.loading-overlay { position: absolute; inset: 76px 0 0; z-index: 4; display: grid; place-items: center; background: rgba(255,255,255,.72); backdrop-filter: blur(2px); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dialog { width: min(570px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); background: white; box-shadow: 0 30px 90px rgba(7,32,31,.25); }
.dialog::backdrop { background: rgba(9,31,31,.52); backdrop-filter: blur(3px); }
.dialog form, .dialog > div, .dialog > p { margin-left: 28px; margin-right: 28px; }
.dialog form { margin-top: 0; margin-bottom: 0; }
.dialog-small { width: min(480px, calc(100% - 28px)); padding-bottom: 26px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 0 -2px 26px; padding-top: 26px; }
.dialog-header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 29px; font-weight: 400; letter-spacing: -.6px; }
.dialog-close { flex: 0 0 auto; }
.date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.optional { margin-left: 5px; color: #9aabaa; font-size: 10px; font-weight: 500; }
.availability-box { display: flex; align-items: center; gap: 12px; min-height: 63px; margin: 6px 0 20px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); }
.availability-box.warning { background: var(--warning-soft); color: #7a5417; }
.availability-box.danger { background: var(--danger-soft); color: #963f3f; }
.availability-box strong { display: block; font-size: 12px; }
.availability-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: rgba(255,255,255,.65); font-weight: 900; }
.dialog-actions { display: flex; align-items: center; gap: 9px; margin: 0 -28px; padding: 18px 28px; border-top: 1px solid var(--line); }
.dialog-spacer { flex: 1; }
.field-help { margin: -9px 0 24px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.doctor-options { display: grid; gap: 8px; margin-bottom: 8px !important; }
.doctor-option { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; background: white; text-align: left; }
.doctor-option:hover { border-color: var(--brand); background: #f8fcfb; }
.doctor-option strong, .doctor-option small { display: block; }.doctor-option small { margin-top: 3px; color: var(--muted); }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(400px, calc(100% - 48px)); padding: 14px 18px; border-radius: 12px; color: white; background: var(--ink); box-shadow: 0 15px 40px rgba(0,0,0,.2); font-size: 13px; animation: toast-in .25s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; padding: 30px; }
  .mobile-brand { display: flex; }
  .day { min-height: 126px; padding: 7px; }
  .vacation-chip { padding: 2px 4px; }
}

@media (max-width: 640px) {
  .topbar { height: 62px; padding: 0 14px; }
  .topbar .brand > span:last-child, .user-block > div, .icon-text-button span:last-child { display: none; }
  .user-block { padding-left: 0; border-left: 0; }
  .top-actions { gap: 7px; }
  .main-content { width: calc(100% - 24px); padding-top: 28px; }
  .page-heading { align-items: flex-start; margin-bottom: 22px; }
  .page-heading > div > p:last-child { display: none; }
  .page-heading-actions { gap: 8px; }
  .page-heading .button { width: 44px; min-width: 44px; padding: 0; font-size: 0; }
  .page-heading .button span { font-size: 20px; }
  .calendar-card { overflow-x: auto; border-radius: 14px; }
  .calendar-toolbar, .weekdays, .calendar-grid { min-width: 920px; }
  .calendar-toolbar { position: sticky; left: 0; width: 100%; }
  .day { min-height: 105px; }
  .month-picker-button { min-width: 160px; font-size: 22px; }
  .calendar-tip { display: none; }
  .date-fields { grid-template-columns: 1fr; gap: 0; }
  .dialog form { margin-left: 20px; margin-right: 20px; }
  .dialog-actions { margin-left: -20px; margin-right: -20px; padding: 15px 20px; flex-wrap: wrap; }
  .dialog-actions .button:not(.button-danger) { flex: 1; }
}

