:root {
  --navy: #14284a;
  --navy-2: #1d3d6b;
  --blue: #2879ff;
  --blue-deep: #0e57d4;
  --cyan: #dff4ff;
  --mint: #dff8eb;
  --green: #11865a;
  --amber: #b76b08;
  --rose: #c84c58;
  --ink: #17243a;
  --muted: #66758a;
  --paper: #f3f6f8;
  --surface: #fff;
  --line: #dce5ec;
  --shadow: 0 18px 52px rgba(25, 55, 94, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font: 15px/1.48 "Segoe UI Variable", "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 12% 15%, #d7f4ff 0, transparent 31%), radial-gradient(circle at 91% 86%, #dce7ff 0, transparent 33%), #eef3f7; }
.login-card { width: min(560px, 100%); padding: 38px; border: 1px solid rgba(255,255,255,.9); border-radius: 30px; background: rgba(255,255,255,.94); box-shadow: 0 30px 95px rgba(27,56,99,.16); backdrop-filter: blur(16px); }
.brand-lockup { display: flex; align-items: center; gap: 16px; }
.brand-logo { width: 70px; height: 70px; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(40,121,255,.18)); }
.brand-lockup h1, .brand-lockup p { margin: 0; }
.brand-lockup h1 { font-size: 34px; line-height: 1.05; letter-spacing: -.045em; }
.eyebrow { margin: 0 0 5px; color: var(--blue-deep); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.login-copy { margin: 25px 0 18px; color: var(--muted); font-size: 17px; }
.login-step { display: flex; align-items: center; gap: 12px; margin: 9px 0; color: #42546d; }
.login-step span { display: grid; flex: 0 0 29px; height: 29px; place-items: center; border-radius: 50%; color: var(--blue-deep); background: #e6f1ff; font-weight: 800; }
.login-step p { margin: 0; }
#login-form { margin-top: 25px; }
label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 750; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; color: var(--ink); background: #fff; outline: none; transition: .16s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(40,121,255,.11); }
#staff-code { font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.form-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.form-error { min-height: 20px; margin-bottom: 0; color: var(--rose); font-size: 13px; }

.button { border: 0; border-radius: 13px; padding: 11px 17px; font-weight: 780; transition: transform .15s, background .15s, opacity .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: white; background: var(--blue); box-shadow: 0 9px 24px rgba(40,121,255,.23); }
.button.primary:hover { background: var(--blue-deep); }
.button.light { position: relative; z-index: 1; color: #173963; background: white; }
.button.yandex { display: block; margin: 24px 0 0; color: #111; background: #ffcc00; text-align: center; text-decoration: none; }
.button.yandex:hover { background: #f2c200; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 5px; color: var(--muted); font-size: 12px; }
.login-divider::before, .login-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.text-action, .link-button { border: 0; padding: 0; color: var(--blue-deep); background: transparent; font-weight: 750; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 15px 18px; color: #eaf2ff; background: linear-gradient(180deg, #122543, #10213a); }
.brand-lockup.compact { padding: 0 10px 24px; }
.brand-lockup.compact .brand-logo { width: 48px; height: 48px; }
.brand-lockup.compact strong { display: block; font-size: 20px; }
.brand-lockup.compact span { color: #9db0ca; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; border-radius: 13px; padding: 11px 13px; color: #b4c2d5; background: transparent; text-align: left; font-weight: 680; }
.nav-item:hover, .nav-item.is-active { color: white; background: rgba(83,144,255,.16); }
.nav-icon { width: 19px; color: #7ca9ef; font-size: 17px; text-align: center; }
.sidebar-foot { margin-top: auto; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 16px 11px 0; border-top: 1px solid rgba(255,255,255,.08); color: #aebdd1; font-size: 11px; }
.sidebar-foot .link-button { grid-column: 2; justify-self: start; color: #8fb9ff; font-size: 12px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #48dda0; box-shadow: 0 0 0 5px rgba(72,221,160,.12); }

.workspace { min-width: 0; max-width: 1500px; width: 100%; margin: 0 auto; padding: 31px 38px 55px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.topbar h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); line-height: 1; letter-spacing: -.055em; }
.profile-chip { display: flex; align-items: center; gap: 10px; max-width: 310px; padding: 7px 10px 7px 7px; border: 1px solid var(--line); border-radius: 999px; background: white; }
.profile-avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: white; background: linear-gradient(135deg, var(--navy-2), var(--blue)); font-weight: 850; }
.profile-avatar img, .team-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.profile-chip strong, .profile-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chip small { max-width: 190px; color: var(--muted); font-size: 11px; }

.view { display: none; animation: enter .22s ease; }
.view.is-active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.hero { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 25px; overflow: hidden; padding: 29px 31px; border-radius: 26px; color: white; background: linear-gradient(125deg, #172e53 0%, #165fc2 65%, #2b8cff 100%); box-shadow: var(--shadow); }
.hero::after { position: absolute; right: -80px; bottom: -160px; width: 260px; height: 260px; border: 45px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; }
.hero-kicker { margin: 0 0 4px; color: #a8d0ff; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.hero h2 { margin: 0 0 7px; font-size: clamp(25px, 4vw, 34px); letter-spacing: -.04em; }
.hero p:last-child { max-width: 620px; margin: 0; color: #dceaff; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(115px, 1fr)); gap: 12px; margin: 17px 0; }
.stat-card { min-height: 116px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 8px 28px rgba(27,56,99,.04); }
.stat-card strong { display: block; font-size: 31px; line-height: 1.15; letter-spacing: -.05em; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card.alert strong { color: var(--rose); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(290px, .65fr); gap: 17px; }
.panel { margin-top: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 34px rgba(27,56,99,.045); }
.dashboard-grid .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 19px 21px; border-bottom: 1px solid #eaf0f4; }
.panel-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.card-list { display: grid; }
.task-card, .attention-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 13px; padding: 15px 21px; border-top: 1px solid #edf1f4; }
.task-card:first-child, .attention-card:first-child { border-top: 0; }
.task-card strong, .attention-card strong { display: block; }
.task-card p, .attention-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.task-date { align-self: start; padding: 5px 8px; border-radius: 9px; color: #4f5f75; background: #eff3f6; font-size: 11px; font-weight: 800; white-space: nowrap; }
.task-date.overdue { color: #a43f49; background: #ffe6e8; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.mini-chip { padding: 3px 7px; border-radius: 8px; color: #3e5b79; background: #edf4fb; font-size: 10px; font-weight: 700; }
.mini-chip.edit-task { border: 0; color: var(--blue-deep); }
.mini-chip.edit-task:hover { background: #dcecff; }
.mini-chip.task-confirm, .mini-chip.task-reject { border: 0; }
.mini-chip.task-confirm { color: #087747; background: #dcf7e9; }
.mini-chip.task-reject { color: #9b3f48; background: #ffe7e9; }
.empty { padding: 28px 21px; color: var(--muted); text-align: center; }
.count-pill { min-width: 30px; padding: 5px 9px; border-radius: 999px; color: var(--blue-deep); background: var(--cyan); font-size: 12px; font-weight: 800; text-align: center; }

.leave-glance-body { padding: 23px; }
.leave-number { display: flex; align-items: baseline; gap: 7px; }
.leave-number strong { font-size: 48px; line-height: 1; letter-spacing: -.06em; }
.leave-number span { color: var(--muted); font-weight: 700; }
.progress { height: 9px; margin: 18px 0 10px; overflow: hidden; border-radius: 999px; background: #e9eff3; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1e68e8, #44b8ee); }
.leave-glance-body p { margin: 0; color: var(--muted); font-size: 12px; }

.section-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 21px; border-left: 4px solid var(--blue); border-radius: 0 17px 17px 0; background: #eaf3ff; }
.section-intro h2, .section-intro p { margin: 0; }
.section-intro h2 { font-size: 18px; }
.section-intro p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.section-intro select { width: 205px; background: white; }
.task-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 17px; }
.attention-panel { align-self: start; }

.search-box { display: flex; align-items: center; gap: 7px; width: min(390px, 100%); margin: 0; padding-left: 11px; border: 1px solid #cbd9e5; border-radius: 13px; color: var(--muted); background: white; }
.search-box input { border: 0; box-shadow: none; background: transparent; }
.collection-summary { display: flex; align-items: baseline; gap: 11px; margin: 16px 2px -3px; }
.collection-summary strong { color: var(--navy-2); }
.collection-summary span { color: var(--muted); font-size: 12px; }
.document-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; margin-top: 17px; }
.document-card { display: flex; min-height: 176px; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 19px; background: white; box-shadow: 0 8px 28px rgba(27,56,99,.04); }
.document-card .file-mark { display: grid; width: 40px; height: 40px; place-items: center; margin-bottom: 13px; border-radius: 12px; color: var(--blue-deep); background: #e8f2ff; font-size: 11px; font-weight: 850; }
.document-card h3 { display: -webkit-box; overflow: hidden; margin: 0; font-size: 15px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.document-card p { margin: 5px 0 13px; color: var(--muted); font-size: 11px; }
.document-card a { margin-top: auto; color: var(--blue-deep); font-weight: 780; text-decoration: none; }
.document-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.document-actions a { margin-top: 0; }
.document-actions .text-action { flex: 0 0 auto; font-size: 11px; }
.compact-documents { grid-template-columns: repeat(3, 1fr); margin: 0; padding: 17px; }
.compact-documents .document-card { min-height: 155px; box-shadow: none; }
.privacy-note { margin: 15px 3px; color: var(--muted); font-size: 12px; }

.project-grid, .team-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; margin-top: 17px; }
.project-card, .team-card { padding: 20px; border: 1px solid var(--line); border-radius: 19px; background: white; }
.project-card h3, .team-card h3 { margin: 0; font-size: 17px; }
.project-card p, .team-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.team-head { display: flex; align-items: center; gap: 12px; }
.team-avatar { display: grid; width: 46px; height: 46px; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: 50%; color: white; background: linear-gradient(135deg, var(--navy-2), var(--blue)); font-size: 13px; font-weight: 850; }
.chat-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chat-chip { padding: 5px 8px; border-radius: 9px; color: #39516f; background: #edf4fa; font-size: 11px; }
.status-line { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; font-weight: 750; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.status-dot.partial { background: #e4a11b; }
.status-dot.unavailable { background: var(--rose); }

.leave-board { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 17px; margin-top: 17px; }
.leave-main, .leave-detail { padding: 25px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.leave-main .leave-number strong { font-size: 66px; color: var(--navy-2); }
.leave-main h3 { margin: 5px 0 0; font-size: 18px; }
.leave-main > p { color: var(--muted); }
.leave-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.leave-metric { padding: 14px; border-radius: 15px; background: #f1f5f8; }
.leave-metric strong, .leave-metric span { display: block; }
.leave-metric strong { font-size: 23px; }
.leave-metric span { color: var(--muted); font-size: 11px; }
.leave-detail h3 { margin-top: 0; }
.leave-detail dl { display: grid; gap: 11px; }
.leave-detail dl div { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 10px; border-bottom: 1px solid #edf1f4; }
.leave-detail dt { color: var(--muted); }
.leave-detail dd { margin: 0; font-weight: 800; }

.task-editor { width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 0; border-radius: 24px; color: var(--ink); background: white; box-shadow: 0 30px 100px rgba(14,35,67,.28); }
.task-editor::backdrop { background: rgba(11,27,49,.56); backdrop-filter: blur(4px); }
.task-editor form { display: grid; gap: 16px; padding: 25px; }
.version-dialog-body { padding: 25px; }
.version-list { display: grid; margin-top: 18px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border-top: 1px solid var(--line); }
.version-row:first-child { border-top: 0; }
.version-row strong { display: block; }
.version-row p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.version-row a { color: var(--blue-deep); font-weight: 780; text-decoration: none; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-head h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; border: 0; border-radius: 50%; color: var(--muted); background: #eef3f7; font-size: 25px; line-height: 1; }
.dialog-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 2px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: 390px; padding: 13px 17px; border-radius: 13px; color: white; background: #172a49; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #a73535; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .document-grid, .project-grid, .team-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
@media (max-width: 900px) {
  .dashboard-grid, .task-layout, .leave-board { grid-template-columns: 1fr; }
  .compact-documents { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  body { padding-bottom: 70px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 8; top: auto; right: 0; bottom: 0; left: 0; height: 68px; padding: 7px 6px env(safe-area-inset-bottom); background: rgba(16,33,58,.97); backdrop-filter: blur(16px); }
  .brand-lockup.compact, .sidebar-foot { display: none; }
  nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; }
  .nav-item { display: grid; min-width: 0; justify-items: center; gap: 0; padding: 5px 1px; border-radius: 10px; font-size: 9px; line-height: 1.1; text-align: center; }
  .nav-icon { height: 25px; font-size: 18px; }
  .workspace { padding: 22px 14px 28px; }
  .topbar { align-items: flex-start; margin-bottom: 19px; }
  .topbar h1 { font-size: 31px; }
  .profile-chip { padding: 5px; border: 0; background: transparent; }
  .profile-chip > span:last-child { display: none; }
  .profile-avatar { width: 36px; height: 36px; }
  .hero { align-items: flex-start; flex-direction: column; padding: 24px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card { min-height: 105px; }
  .section-intro { align-items: stretch; flex-direction: column; }
  .section-intro select, .search-box { width: 100%; }
  .collection-summary { align-items: flex-start; flex-direction: column; gap: 2px; }
  .document-grid, .project-grid, .team-grid, .compact-documents { grid-template-columns: 1fr; }
  .document-card { min-height: 148px; }
  .leave-metrics { grid-template-columns: 1fr 1fr; }
  .code-row { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px; }
  .login-card .brand-logo { width: 58px; height: 58px; }
  .login-card h1 { font-size: 29px; }
  .task-editor { width: 100vw; max-width: none; max-height: calc(100vh - 16px); margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .task-editor form { padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .dialog-fields { grid-template-columns: 1fr; }
  .dialog-actions .button { flex: 1; }
}
