:root {
  color-scheme: light;
  --ink: #17252a;
  --muted: #6d7b7e;
  --line: #dfe8e7;
  --soft: #f4f8f7;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #dff5f1;
  --violet: #6d5bd0;
  --violet-soft: #eeebff;
  --sand: #f2eee5;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --shadow: 0 18px 50px rgba(30, 65, 62, 0.10);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #f7faf9; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: 21px; letter-spacing: -.02em; }
.muted { color: var(--muted); line-height: 1.5; }
.eyebrow { margin-bottom: 7px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px 18px; background: #112d2b; color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 0 8px 26px; }
.brand strong { display: block; font-size: 17px; }
.brand small { display: block; color: #9bc5c0; margin-top: 3px; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; color: #103c38; background: #83e1d3; font-weight: 900; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.nav-list { display: grid; gap: 6px; }
.nav-item { border: 0; border-radius: 11px; padding: 11px 12px; background: transparent; color: #bad2cf; text-align: left; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.nav-item:hover, .nav-item.is-active { background: rgba(131, 225, 211, .13); color: #fff; }
.nav-item span { width: 20px; text-align: center; color: #83e1d3; font-size: 18px; }
.future-modules { margin: 30px 8px 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 12px; }
.future-modules p { margin: 0 0 2px; color: #6f9d98; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.future-modules span { color: #8eaaa7; font-size: 13px; display: flex; justify-content: space-between; }
.future-modules small { padding: 2px 6px; border-radius: 12px; background: rgba(255,255,255,.08); font-size: 10px; }
.sidebar-user { margin-top: auto; display: grid; grid-template-columns: 36px 1fr 32px; gap: 10px; align-items: center; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user small { color: #8eb2ae; margin-top: 3px; font-size: 11px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #2a4e4a; display: grid; place-items: center; font-weight: 900; color: #a8ece2; }
.sidebar .icon-button { color: #bdd5d2; }

.main-content { min-width: 0; padding: 38px 42px 60px; }
.view-panel { max-width: 1520px; margin: 0 auto; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header p:last-child { margin-bottom: 0; }
.header-controls { display: flex; align-items: flex-end; gap: 10px; }
.manager-picker { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
select, input, textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid #cfdcda; border-radius: 10px; padding: 10px 12px; outline: none; }
select:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.manager-picker select { min-width: 200px; }
.primary-button, .secondary-button, .danger-button { border: 0; border-radius: 10px; padding: 10px 16px; min-height: 40px; font-weight: 800; }
.primary-button { color: #fff; background: var(--accent); box-shadow: 0 5px 14px rgba(15,118,110,.18); }
.primary-button:hover { background: var(--accent-strong); }
.secondary-button { color: #31504d; background: #fff; border: 1px solid #d7e1e0; }
.secondary-button:hover { background: var(--soft); }
.danger-button { color: var(--danger); background: var(--danger-soft); }
.full-width { width: 100%; }
.segmented { display: flex; border: 1px solid #d7e1e0; border-radius: 10px; overflow: hidden; background: #fff; }
.segmented button { width: 40px; height: 40px; border: 0; background: #fff; color: #405b58; font-size: 19px; }
.segmented button + button { border-left: 1px solid #d7e1e0; }
.segmented button:hover { background: var(--soft); }
.icon-button { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 20px; }
.icon-button:hover { background: rgba(255,255,255,.1); }

.calendar-summary { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 12px; }
.sync-warning { margin-bottom: 16px; padding: 15px 18px; border: 1px solid #f2c9a5; border-radius: 12px; background: #fff7ed; color: #824516; display: grid; gap: 5px; font-size: 13px; }
.sync-warning span { color: #9a5b27; }
.sync-warning ul { margin: 5px 0 0; padding-left: 19px; }
.sync-warning a { color: #824516; font-weight: 800; }
.calendar-summary > strong { font-size: 15px; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.free { background: #42baa9; }
.dot.booked { background: var(--violet); }
.dot.blocked { background: #9c927d; }
.loading-card { min-height: 360px; border: 1px solid var(--line); border-radius: 16px; background: #fff; display: grid; place-items: center; color: var(--muted); }
.calendar-grid { display: grid; grid-template-columns: 72px repeat(7, minmax(138px, 1fr)); min-width: 1050px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--line); gap: 1px; box-shadow: var(--shadow); }
.calendar-grid-wrap { overflow-x: auto; padding: 0 0 18px; }
.calendar-corner, .day-heading, .time-cell, .slot-cell { background: #fff; }
.calendar-corner { min-height: 86px; }
.day-heading { min-height: 86px; padding: 13px 10px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; position: relative; }
.day-heading.is-today { background: #edfaf7; }
.day-heading strong { font-size: 14px; }
.day-heading span { color: var(--muted); margin-top: 4px; font-size: 12px; }
.day-heading .day-action { margin-top: 7px; border: 0; background: transparent; color: var(--accent); font-size: 10px; font-weight: 800; padding: 2px 5px; }
.day-heading .day-action:hover { text-decoration: underline; }
.time-cell { min-height: 68px; padding: 14px 9px; color: #607472; text-align: right; font-size: 12px; font-weight: 800; }
.slot-cell { min-height: 68px; padding: 6px; }
.slot-button { width: 100%; min-height: 55px; border: 1px solid transparent; border-radius: 10px; padding: 7px 8px; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 3px; transition: transform .12s ease, border-color .12s ease; }
.slot-button strong, .slot-button small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.slot-button strong { font-size: 12px; }
.slot-button small { font-size: 10px; opacity: .76; }
.slot-button.free { color: #176d64; background: #effaf7; border-color: #d4f0eb; }
.slot-button.free:hover { border-color: #56bcae; transform: translateY(-1px); }
.slot-button.booked { color: #5140ad; background: var(--violet-soft); border-color: #ddd7ff; }
.slot-button.booked:hover { border-color: #9486e8; }
.slot-button.blocked { color: #716957; background: var(--sand); border-color: #e4dece; }
.slot-button.blocked:hover { border-color: #bfb399; }
.slot-button.unavailable { color: #a0acaa; background: #f7f9f8; border: 0; cursor: default; align-items: center; }

.settings-card, .info-card { border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.settings-card { padding: 24px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.settings-card p { margin-bottom: 0; }
.settings-icon { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 26px; font-weight: 900; }
.info-card { margin-top: 18px; padding: 24px 26px; color: #455e5b; }
.info-card ol { margin-bottom: 0; padding-left: 21px; line-height: 1.8; }
.amo-status { margin: 12px 0 0 !important; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 800; color: var(--accent); }
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.team-grid .settings-card { display: flex; flex-direction: column; align-items: stretch; }
.stack-form { display: grid; gap: 15px; }
.stack-form label { display: grid; gap: 6px; color: #38524f; font-size: 12px; font-weight: 800; }

dialog { width: min(520px, calc(100vw - 30px)); border: 0; border-radius: 18px; padding: 0; color: var(--ink); box-shadow: 0 30px 90px rgba(19,47,44,.28); }
dialog::backdrop { background: rgba(11,35,33,.52); backdrop-filter: blur(3px); }
.dialog-card { padding: 25px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.dialog-heading .icon-button { flex: 0 0 auto; color: var(--muted); background: var(--soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.reason-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.reason-option { position: relative; }
.reason-option input { position: absolute; opacity: 0; pointer-events: none; }
.reason-option span { min-height: 62px; border: 1px solid var(--line); border-radius: 11px; padding: 11px; display: flex; align-items: center; justify-content: center; text-align: center; color: #536865; font-size: 12px; font-weight: 800; }
.reason-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); box-shadow: 0 0 0 2px rgba(15,118,110,.08); }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; font-weight: 700; }
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 50; max-width: 380px; padding: 13px 16px; color: #fff; background: #143d39; border-radius: 11px; box-shadow: var(--shadow); font-size: 13px; font-weight: 700; }

.login-page { background: #eaf3f1; display: grid; place-items: center; padding: 28px; }
.login-shell { width: min(960px, 100%); min-height: 590px; display: grid; grid-template-columns: 1.15fr .85fr; border-radius: 24px; overflow: hidden; box-shadow: 0 30px 100px rgba(25,64,60,.18); }
.login-aside { padding: 45px; background: #123d39; color: #fff; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-aside::after { content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%; right: -160px; bottom: -160px; border: 70px solid rgba(131,225,211,.09); }
.login-aside .brand-mark { margin-bottom: 56px; }
.login-aside h1 { font-size: 46px; max-width: 430px; }
.login-aside p:not(.eyebrow) { color: #b7d4d0; line-height: 1.65; max-width: 430px; }
.login-slot-preview { position: relative; z-index: 1; width: 320px; display: grid; grid-template-columns: 60px 1fr; gap: 7px 12px; align-items: center; }
.login-slot-preview span { color: #88aaa6; font-size: 12px; font-weight: 800; }
.login-slot-preview strong { color: #174b45; background: #b2eee5; padding: 9px 11px; border-radius: 9px; font-size: 12px; }
.login-slot-preview .preview-booked { color: #5140ad; background: #ded8ff; }
.login-slot-preview .preview-blocked { color: #645d4d; background: #e9e2d2; }
.login-card { padding: 54px 48px; background: #fff; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { font-size: 30px; }

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .brand > span:last-child, .nav-item:not(.is-active) ~ span, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item span { font-size: 20px; }
  .future-modules, .sidebar-user > div:nth-child(2) { display: none; }
  .sidebar-user { grid-template-columns: 36px; justify-content: center; }
  .sidebar-user .icon-button { display: none; }
  .main-content { padding-inline: 25px; }
  .page-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 40; left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 70px; padding: 8px 14px; flex-direction: row; align-items: center; box-shadow: 0 -10px 35px rgba(17,45,43,.18); }
  .brand, .future-modules, .sidebar-user { display: none; }
  .nav-list { width: 100%; display: flex; justify-content: space-around; }
  .nav-item { font-size: 11px; flex-direction: column; gap: 2px; padding: 4px 10px; }
  .nav-item span { font-size: 18px; }
  .main-content { padding: 25px 16px 100px; }
  .header-controls { width: 100%; flex-wrap: wrap; }
  .manager-picker { flex: 1 0 100%; }
  .manager-picker select { min-width: 0; }
  .calendar-summary { align-items: flex-start; flex-direction: column; }
  .legend { flex-wrap: wrap; }
  .team-grid { grid-template-columns: 1fr; }
  .settings-card { grid-template-columns: auto 1fr; }
  .settings-card > button { grid-column: 1 / -1; }
  .login-page { padding: 0; }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; border-radius: 0; }
  .login-aside { min-height: 280px; padding: 32px; }
  .login-aside .brand-mark, .login-slot-preview { display: none; }
  .login-aside h1 { font-size: 36px; }
  .login-card { padding: 38px 30px; }
}
