:root {
    --green-700: #2d8717;
    --green-600: #36951e;
    --green-500: #4aaa31;
    --green-100: #eaf6e6;
    --green-050: #f5fbf3;
    --red-600: #d92b22;
    --ink-900: #20251f;
    --ink-700: #465044;
    --ink-500: #747d72;
    --line: #dfe5dc;
    --surface: #ffffff;
    --canvas: #f5f7f3;
    --warning: #a96305;
    --danger: #b42318;
    --info: #2165a6;
    --shadow: 0 16px 48px rgba(31, 49, 25, .10);
    --radius: 14px;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--ink-900);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink-900); }
a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-600); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 3vw, 2.35rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; }
p { line-height: 1.55; }
.muted { color: var(--ink-500); }
.eyebrow { margin: 0 0 .55rem; color: var(--green-700); font-size: .76rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.required { color: var(--red-600); }
.text-danger { color: var(--danger); }
.nowrap { white-space: nowrap; }

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 42px; padding: .65rem 1rem; border: 1px solid transparent; border-radius: 8px;
    font: inherit; font-weight: 700; line-height: 1; cursor: pointer; transition: .18s ease;
}
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button-primary { background: var(--green-700); color: white; box-shadow: 0 6px 16px rgba(45,135,23,.20); }
.button-primary:hover { background: var(--green-600); color: white; }
.button-outline { border-color: var(--green-600); color: var(--green-700); background: white; }
.button-outline:hover { background: var(--green-050); }
.button-ghost { border-color: var(--line); color: var(--ink-700); background: white; }
.button-danger { background: #fff1f0; border-color: #fac5c1; color: var(--danger); }
.button-danger:hover { background: #ffe4e1; color: var(--danger); }
.button-large { min-height: 48px; padding: .8rem 1.25rem; }
.button-small { min-height: 34px; padding: .45rem .7rem; font-size: .85rem; }
.button-block { width: 100%; }

label { display: grid; gap: .42rem; color: var(--ink-700); font-size: .9rem; font-weight: 650; }
input, textarea, select {
    width: 100%; border: 1px solid #ccd5c8; border-radius: 8px; background: #fff; color: var(--ink-900);
    padding: .72rem .8rem; font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 78px; }
input:focus, textarea:focus, select:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(54,149,30,.12); }
input[readonly], input:disabled, select:disabled { background: #f0f2ef; color: var(--ink-500); }
small { color: var(--ink-500); font-weight: 400; line-height: 1.35; }
fieldset { margin: 0; padding: 1.15rem; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfa; }
legend { padding: 0 .5rem; color: var(--ink-900); font-weight: 800; }
.stack-form { display: grid; gap: 1.15rem; }
.form-grid { display: grid; gap: 1rem; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .75rem; }
.form-note { margin: 0; padding: .8rem 1rem; border-left: 3px solid var(--green-600); background: var(--green-050); color: var(--ink-700); font-size: .9rem; }
.checkbox-label { grid-template-columns: 20px 1fr; align-items: start; gap: .65rem; font-weight: 500; line-height: 1.45; }
.checkbox-label input { width: 18px; height: 18px; margin-top: .1rem; accent-color: var(--green-700); }
.hp-field { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

.alert { padding: .85rem 1rem; border: 1px solid; border-radius: 10px; line-height: 1.45; }
.alert ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.alert-success { color: #256b16; background: #eff9ec; border-color: #b9dfad; }
.alert-warning { color: #80500d; background: #fff8e8; border-color: #efd494; }
.alert-danger { color: #8d2018; background: #fff2f1; border-color: #efc2be; }
.alert-info { color: #215b8c; background: #eff7ff; border-color: #bed9f0; }

/* Установка */
.install-page { min-height: 100vh; background: linear-gradient(145deg, #eef7ea, #f8f9f6 50%, #fff2ef); padding: 2rem 1rem; }
.install-shell { width: min(920px,100%); margin: 0 auto; }
.install-card { padding: clamp(1.25rem,4vw,2.5rem); border: 1px solid rgba(223,229,220,.9); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.install-header { display: grid; grid-template-columns: 190px 1fr; gap: 2rem; align-items: center; margin-bottom: 1.5rem; }
.install-logo { width: 190px; }
.install-header p:last-child { margin-bottom: 0; color: var(--ink-500); }
.requirements { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; margin: 1.25rem 0; }
.requirement { display: flex; gap: .65rem; align-items: center; padding: .7rem .8rem; border-radius: 8px; background: #f6f7f5; font-size: .9rem; }
.requirement span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 900; }
.requirement.ok span { background: var(--green-100); color: var(--green-700); }
.requirement.fail span { background: #fff0ee; color: var(--danger); }

/* Авторизация */
.auth-page { background: white; }
.auth-split { display: grid; grid-template-columns: minmax(430px, 42%) 1fr; min-height: 100vh; }
.auth-form-panel { display: grid; place-items: center; padding: 3rem clamp(1.5rem,5vw,5rem); background: white; }
.auth-form-wrap { width: min(420px,100%); }
.auth-logo { width: 215px; margin-bottom: 3.5rem; }
.auth-form-wrap h1 { margin-bottom: .5rem; }
.auth-form-wrap > .muted { margin: 0 0 1.5rem; }
.auth-form { margin-top: 1.25rem; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 5.5rem; }
.password-toggle { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--green-700); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.auth-row { display: flex; justify-content: flex-end; margin-top: -.35rem; font-size: .88rem; }
.auth-register-link { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--ink-500); }
.auth-visual { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 100vh; padding: 3rem; color: white; background: radial-gradient(circle at 72% 22%, rgba(255,255,255,.22), transparent 20%), linear-gradient(150deg, #4aaa31 0%, #2d8717 47%, #195a0a 100%); background-size: cover; background-position: center; }
.auth-visual::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 35%, rgba(0,0,0,.16)); }
.auth-visual.has-image::before { background: linear-gradient(90deg, rgba(31,61,22,.10), rgba(20,44,12,.28)); }
.visual-placeholder { position: relative; z-index: 1; width: min(520px,100%); padding: 3rem; border: 1px solid rgba(255,255,255,.35); border-radius: 24px; background: rgba(255,255,255,.09); backdrop-filter: blur(8px); }
.visual-placeholder .eyebrow { color: white; opacity: .85; }
.visual-placeholder h2 { font-size: clamp(2rem,4vw,3.5rem); }
.visual-mark { display: grid; place-items: center; width: 70px; height: 70px; margin-bottom: 2rem; border-radius: 50%; background: white; color: var(--red-600); font: 800 2.4rem Georgia, serif; }
.simple-auth-page { background: linear-gradient(180deg, #fff 0, #f4f7f2 280px); }
.simple-auth-header { height: 94px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0 max(1.5rem,calc((100vw - 1180px)/2)); border-bottom: 4px solid var(--green-700); background: white; }
.simple-auth-header img { width: 190px; display: block; }
.simple-auth-header span { color: var(--ink-500); }
.simple-auth-main { width: min(1080px,calc(100% - 2rem)); margin: 2.5rem auto; }
.public-card { padding: clamp(1.25rem,4vw,2rem); border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 12px 34px rgba(41,58,36,.07); }
.public-card-wide { width: 100%; }
.auth-narrow-card, .success-card { width: min(500px,100%); margin: 4rem auto; text-align: left; }
.success-card { text-align: center; }
.success-icon { display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto 1.25rem; border-radius: 50%; background: var(--green-100); color: var(--green-700); font-size: 2rem; font-weight: 900; }
.back-link { display: inline-block; margin-top: 1.25rem; }

/* Рабочая область */
.app-page { background: var(--canvas); }
.app-shell { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.35rem 1rem; border-right: 1px solid var(--line); background: white; z-index: 20; }
.sidebar-logo { display: block; width: 184px; padding: .35rem .7rem 1.4rem; }
.sidebar-nav { display: grid; gap: .3rem; }
.sidebar-nav a { display: flex; align-items: center; gap: .75rem; padding: .72rem .8rem; border-radius: 9px; color: var(--ink-700); font-size: .92rem; font-weight: 650; }
.sidebar-nav a:hover { background: var(--green-050); color: var(--green-700); }
.sidebar-nav a.active { background: var(--green-100); color: var(--green-700); }
.nav-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #f1f3ef; font-size: .8rem; font-weight: 900; }
.sidebar-nav a.active .nav-icon { background: white; }
.sidebar-bottom { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.sidebar-user { padding: .65rem .75rem; }
.sidebar-user strong, .sidebar-user span { display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user span { margin-top: .2rem; color: var(--ink-500); font-size: .76rem; }
.logout-form button { width: 100%; justify-content: flex-start; background: transparent; color: var(--ink-500); }
.app-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 2rem; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(8px); }
.topbar-title { font-weight: 800; }
.topbar-meta { color: var(--ink-500); font-size: .85rem; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 1.5rem; }
.content { width: min(1500px,100%); padding: 2rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.page-heading.compact { margin-bottom: 1.25rem; }
.page-heading p { margin: .35rem 0 0; color: var(--ink-500); }
.heading-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 4px 18px rgba(35,53,29,.04); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.card-body { padding: 1.15rem; }
.card-grid { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: 1rem; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card { padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 12px; background: white; }
.stat-card span { color: var(--ink-500); font-size: .82rem; }
.stat-card strong { display: block; margin-top: .35rem; font-size: 1.75rem; }
.stat-card.highlight { color: white; border-color: var(--green-700); background: linear-gradient(135deg,var(--green-700),var(--green-500)); }
.stat-card.highlight span { color: rgba(255,255,255,.78); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: .72rem .85rem; border-bottom: 1px solid var(--line); color: var(--ink-500); background: #fafbfa; text-align: left; font-size: .76rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
td { padding: .82rem .85rem; border-bottom: 1px solid #edf0eb; vertical-align: top; font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfb; }
.table-title { color: var(--ink-900); font-weight: 750; }
.table-sub { display: block; margin-top: .2rem; color: var(--ink-500); font-size: .78rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; min-height: 25px; padding: .25rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.badge-green { background: var(--green-100); color: var(--green-700); }
.badge-gray { background: #eef0ed; color: #5c655a; }
.badge-yellow { background: #fff3d7; color: #8b5a0a; }
.badge-red { background: #ffebe9; color: #a7281e; }
.badge-blue { background: #e9f4ff; color: #246493; }
.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: .7rem; margin-bottom: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: 11px; background: white; }
.filter-bar label { min-width: 160px; font-size: .78rem; }
.filter-bar input, .filter-bar select { padding: .55rem .65rem; }
.definition-list { display: grid; grid-template-columns: minmax(150px,.75fr) minmax(0,1.5fr); gap: 0; margin: 0; }
.definition-list dt, .definition-list dd { margin: 0; padding: .7rem 0; border-bottom: 1px solid #edf0eb; }
.definition-list dt { color: var(--ink-500); font-size: .82rem; }
.definition-list dd { font-weight: 600; overflow-wrap: anywhere; }
.timeline { display: grid; gap: .8rem; }
.timeline-item { display: grid; grid-template-columns: 12px 1fr; gap: .7rem; }
.timeline-dot { width: 10px; height: 10px; margin-top: .35rem; border-radius: 50%; background: var(--green-500); box-shadow: 0 0 0 4px var(--green-100); }
.timeline-item p { margin: 0; }
.timeline-item small { display: block; margin-top: .15rem; }
.empty-state { max-width: 600px; margin: 5rem auto; padding: 2rem; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 1rem; border-radius: 50%; background: var(--green-100); color: var(--green-700); font-size: 1.5rem; font-weight: 900; }
.tour-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.tour-card { display: flex; flex-direction: column; gap: .85rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 5px 18px rgba(35,53,29,.04); }
.tour-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tour-card h2 { font-size: 1.15rem; }
.tour-dates { margin: -.4rem 0 0; color: var(--green-700); font-weight: 700; }
.tour-description { min-height: 3.2em; margin: 0; color: var(--ink-500); font-size: .9rem; }
.tour-facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .5rem; margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--line); }
.tour-facts span,.tour-facts strong { display: block; }
.tour-facts span { color: var(--ink-500); font-size: .72rem; }
.tour-facts strong { margin-top: .2rem; font-size: .87rem; }
.tourist-row { margin-bottom: .9rem; padding: .9rem; border: 1px solid var(--line); border-radius: 9px; background: white; }

@media (max-width: 1000px) {
    .auth-split { grid-template-columns: minmax(380px,50%) 1fr; }
    .auth-visual { padding: 1.5rem; }
    .visual-placeholder { padding: 2rem; }
    .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
    .tour-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
    .form-grid.cols-2, .form-grid.cols-3, .requirements { grid-template-columns: 1fr; }
    .install-header { grid-template-columns: 1fr; gap: 1rem; }
    .auth-split { grid-template-columns: 1fr; }
    .auth-form-panel { padding: 2rem 1.25rem; }
    .auth-logo { margin-bottom: 2.2rem; }
    .auth-visual { min-height: 280px; order: -1; }
    .visual-placeholder { padding: 1.5rem; }
    .visual-placeholder h2 { font-size: 1.65rem; }
    .simple-auth-header { height: auto; padding: 1rem; align-items: flex-start; }
    .simple-auth-header img { width: 150px; }
    .simple-auth-header span { display: none; }
    .simple-auth-main { margin-top: 1rem; }
    .app-shell { display: block; }
    .sidebar { position: fixed; left: -270px; width: 250px; transition: left .2s ease; box-shadow: var(--shadow); }
    .menu-open .sidebar { left: 0; }
    .menu-open::after { content: ''; position: fixed; z-index: 18; inset: 0; background: rgba(20,30,18,.35); }
    .topbar { height: 60px; padding: 0 1rem; }
    .menu-toggle { display: block; }
    .topbar-title { margin-right: auto; }
    .topbar-meta { display: none; }
    .content { padding: 1rem; }
    .page-heading { display: grid; }
    .heading-actions { justify-content: flex-start; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .card-grid { display: grid; grid-template-columns: 1fr; }
    .span-4, .span-5, .span-6, .span-7, .span-8, .span-12 { grid-column: 1; }
    .definition-list { grid-template-columns: 1fr; }
    .definition-list dt { padding-bottom: .15rem; border-bottom: 0; }
    .definition-list dd { padding-top: 0; }
    .tour-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .auth-register-link, .form-actions { align-items: stretch; flex-direction: column; }
    .form-actions .button { width: 100%; }
    .stat-grid { grid-template-columns: 1fr; }
    fieldset { padding: .9rem; }
}
