:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-strong: #eef2f7;
    --sidebar: #101827;
    --sidebar-soft: #182235;
    --text: #172033;
    --text-soft: #657084;
    --text-faint: #9099aa;
    --line: #e3e8ef;
    --line-strong: #d6dce6;
    --primary: #5b5bd6;
    --primary-dark: #4949ba;
    --primary-soft: #eeeeff;
    --teal: #0f9f8f;
    --teal-soft: #e7f8f5;
    --red: #d74747;
    --red-soft: #fff0f0;
    --amber: #b87413;
    --amber-soft: #fff7e8;
    --blue: #2d73c5;
    --blue-soft: #edf5ff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .035);
    --shadow-lg: 0 22px 60px rgba(15, 23, 42, .18);
    --radius: 14px;
    --radius-sm: 10px;
    --sidebar-width: 250px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.boot-screen {
    min-height: 100vh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 16px;
    color: var(--text-soft);
}

.boot-logo, .brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(145deg, #7777ea, #4e4ec4);
    box-shadow: 0 8px 24px rgba(91, 91, 214, .3);
    font-size: 18px;
    font-weight: 800;
}

.boot-line {
    width: 160px;
    height: 3px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--line);
}

.boot-line span {
    display: block;
    width: 45%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    animation: boot 1.1s ease-in-out infinite alternate;
}

@keyframes boot { to { transform: translateX(125%); } }

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, .86fr) minmax(460px, 1.14fr);
    background: var(--surface);
}

.auth-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: clamp(28px, 5vw, 64px);
    overflow: hidden;
    color: #fff;
    background: #101827;
}

.auth-visual::before,
.auth-visual::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(2px);
    pointer-events: none;
}

.auth-visual::before {
    width: 460px;
    height: 460px;
    right: -230px;
    top: 13%;
    background: radial-gradient(circle, rgba(91, 91, 214, .42), rgba(91, 91, 214, 0) 68%);
}

.auth-visual::after {
    width: 360px;
    height: 360px;
    left: -170px;
    bottom: -90px;
    background: radial-gradient(circle, rgba(15, 159, 143, .22), rgba(15, 159, 143, 0) 70%);
}

.auth-brand, .auth-message, .auth-foot { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand .brand-mark { width: 44px; height: 44px; }
.auth-brand strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.auth-brand span { color: #95a0b5; font-size: 12px; }

.auth-message { max-width: 540px; }
.auth-eyebrow { color: #9d9ded; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.auth-message h1 { margin: 14px 0 18px; font-size: clamp(36px, 4.2vw, 62px); line-height: 1.03; letter-spacing: -.055em; }
.auth-message p { max-width: 480px; margin: 0; color: #acb6c8; font-size: clamp(15px, 1.4vw, 18px); line-height: 1.75; }
.auth-foot { color: #728097; font-size: 12px; }

.auth-form-wrap {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 34px;
}

.auth-form { width: min(430px, 100%); }
.auth-form h2 { margin: 0 0 8px; font-size: 29px; letter-spacing: -.035em; }
.auth-form > p { margin: 0 0 28px; color: var(--text-soft); }
.auth-form .btn { margin-top: 8px; }

.config-alert {
    padding: 15px;
    margin: 0 0 22px;
    border: 1px solid #f1d29b;
    border-radius: var(--radius-sm);
    color: #765019;
    background: var(--amber-soft);
}

.config-alert strong { display: block; margin-bottom: 7px; color: #56370c; }
.config-alert ul { padding-left: 18px; margin: 8px 0 0; }
.config-path { display: inline-block; margin-top: 9px; padding: 5px 8px; border-radius: 6px; color: #4e3a19; background: rgba(255,255,255,.65); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label, .field-label { color: #344054; font-size: 12px; font-weight: 700; }
.field small { color: var(--text-faint); font-size: 11px; }

.input, .select, .textarea {
    width: 100%;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.textarea { min-height: 102px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #a2aaba; }
.input:focus, .select:focus, .textarea:focus { border-color: #8b8be7; box-shadow: 0 0 0 3px rgba(91, 91, 214, .12); }
.input:disabled, .select:disabled, .textarea:disabled { color: var(--text-soft); background: #f3f5f8; cursor: not-allowed; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    transition: transform .12s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { color: #fff; background: var(--primary); box-shadow: 0 6px 15px rgba(91, 91, 214, .2); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { border-color: var(--line-strong); background: var(--surface); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-soft); }
.btn-ghost { padding-inline: 9px; border-color: transparent; color: var(--text-soft); background: transparent; }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-strong); }
.btn-danger { color: var(--red); border-color: #f2c9c9; background: var(--red-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.icon-btn { width: 38px; padding: 0; }

.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    padding: 20px 14px max(16px, env(safe-area-inset-bottom));
    color: #d9e0eb;
    background: var(--sidebar);
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.sidebar-brand .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 16px; }
.sidebar-brand strong { display: block; color: #fff; font-size: 14px; }
.sidebar-brand span { display: block; color: #75839a; font-size: 10px; }
.nav-label { padding: 10px 10px 7px; color: #68768e; font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 3px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 41px;
    padding: 9px 11px;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    color: #98a5b9;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.nav-item svg { width: 17px; height: 17px; }
.nav-item:hover { color: #e6eaf1; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: #29334a; box-shadow: inset 3px 0 0 #7777ea; }
.nav-badge { min-width: 20px; padding: 1px 6px; margin-left: auto; border-radius: 999px; color: #b9b9ff; background: rgba(119,119,234,.14); font-size: 10px; text-align: center; }
.sidebar-spacer { flex: 1; }

.sidebar-user {
    display: grid;
    grid-template-columns: 35px 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 11px 9px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.avatar {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(145deg, #6a6ade, #4e4eb6);
    font-size: 12px;
    font-weight: 800;
}

.sidebar-user strong { display: block; overflow: hidden; color: #eef2f8; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user span { color: #7f8da3; font-size: 10px; }
.sidebar-user .btn { color: #7f8da3; }

.main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.mobile-header { display: none; }

.content {
    width: min(1500px, 100%);
    padding: 27px clamp(22px, 3vw, 42px) 48px;
    margin: 0 auto;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    min-height: 60px;
    margin-bottom: 21px;
}

.page-head h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -.035em; }
.page-head p { margin: 6px 0 0; color: var(--text-soft); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.stat-card, .panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-card { position: relative; min-height: 116px; padding: 18px; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 85px; height: 85px; right: -34px; bottom: -38px; border-radius: 50%; background: var(--stat-soft, var(--primary-soft)); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { color: var(--text-soft); font-size: 12px; font-weight: 650; }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--stat-color, var(--primary)); background: var(--stat-soft, var(--primary-soft)); }
.stat-icon svg { width: 16px; height: 16px; }
.stat-value { margin-top: 12px; font-size: 25px; font-weight: 800; letter-spacing: -.035em; }
.stat-note { margin-top: 2px; color: var(--text-faint); font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); gap: 16px; }
.panel { min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 55px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 14px; letter-spacing: -.015em; }
.panel-head p { margin: 3px 0 0; color: var(--text-faint); font-size: 11px; }
.panel-body { padding: 17px; }

.status-bars { display: grid; gap: 14px; }
.status-bar-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 12px; }
.status-bar-head span:first-child { color: #495467; font-weight: 650; }
.status-bar-head span:last-child { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; overflow: hidden; border-radius: 99px; background: #edf0f5; }
.bar-fill { height: 100%; min-width: 3px; border-radius: inherit; background: var(--bar, var(--primary)); }

.city-list, .activity-list, .timeline, .comments-list { display: grid; gap: 0; }
.city-row, .activity-row { display: flex; align-items: center; gap: 11px; min-height: 46px; border-bottom: 1px solid #edf0f4; }
.city-row:last-child, .activity-row:last-child { border-bottom: 0; }
.city-rank { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; color: var(--primary); background: var(--primary-soft); font-size: 10px; font-weight: 800; }
.city-row strong, .activity-row strong { font-size: 12px; }
.city-row span, .activity-row span { margin-left: auto; color: var(--text-soft); font-size: 11px; }
.activity-row .avatar { width: 30px; height: 30px; border-radius: 8px; }
.activity-info { min-width: 0; flex: 1; }
.activity-info strong, .activity-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-info small { color: var(--text-faint); font-size: 10px; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px;
    border-bottom: 1px solid var(--line);
}

.search-box { position: relative; min-width: 250px; flex: 1; }
.search-box svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; color: var(--text-faint); transform: translateY(-50%); pointer-events: none; }
.search-box .input { padding-left: 36px; }
.toolbar .select { width: auto; min-width: 145px; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { height: 43px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: #798397; background: #fafbfd; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { height: 59px; padding: 10px 14px; border-bottom: 1px solid #edf0f4; color: #354054; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .12s ease; }
.data-table tbody tr:hover { background: #fafbfe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.check-cell { width: 42px; }
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.customer-name { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.customer-avatar { display: grid; place-items: center; width: 33px; height: 33px; flex: 0 0 auto; border-radius: 10px; color: #4f52b7; background: #eef0ff; font-size: 11px; font-weight: 800; }
.customer-name strong { display: block; color: var(--text); font-size: 12px; }
.customer-name small { color: var(--text-faint); font-size: 10px; }
.muted { color: var(--text-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--status-color, #4e52b6);
    background: var(--status-bg, #eef0ff);
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-yeni { --status-color: #4f55bc; --status-bg: #eef0ff; }
.status-arandi { --status-color: #276aad; --status-bg: #eaf4ff; }
.status-ulasilamadi { --status-color: #a36a13; --status-bg: #fff5df; }
.status-kullanilmiyor { --status-color: #737b89; --status-bg: #eff1f4; }
.status-yanlis-numara { --status-color: #c24545; --status-bg: #ffeded; }
.status-depozito { --status-color: #087e71; --status-bg: #e4f7f3; }

.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 56px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--text-soft); font-size: 11px; }
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination button { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--text-soft); background: #fff; }
.pagination button:hover:not(:disabled), .pagination button.active { color: var(--primary); border-color: #bdbded; background: var(--primary-soft); }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }
.mobile-customer-list { display: none; }

.bulk-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border-bottom: 1px solid #d9dcf4;
    background: #f2f2ff;
}
.bulk-bar strong { margin-right: auto; color: #4949ad; font-size: 12px; }
.bulk-bar .select { width: 165px; min-height: 36px; }

.empty-state { display: grid; justify-items: center; gap: 7px; min-height: 260px; padding: 42px 20px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 3px; border-radius: 15px; color: var(--primary); background: var(--primary-soft); }
.empty-icon svg { width: 23px; height: 23px; }
.empty-state h3 { margin: 0; font-size: 14px; }
.empty-state p { max-width: 380px; margin: 0; color: var(--text-soft); font-size: 12px; }

.dropzone {
    display: grid;
    justify-items: center;
    gap: 9px;
    min-height: 210px;
    padding: 30px;
    border: 1.5px dashed #c8cfda;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    background: #fafbfc;
    transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.dragging { border-color: #8e8ee7; background: #f7f7ff; }
.dropzone-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 13px; color: var(--primary); background: var(--primary-soft); }
.dropzone-icon svg { width: 22px; height: 22px; }
.dropzone strong { font-size: 13px; }
.dropzone span { color: var(--text-soft); font-size: 11px; }
.upload-progress { width: min(340px, 100%); margin-top: 5px; }
.upload-progress .bar-track { height: 5px; }

.import-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr); gap: 16px; }
.import-card { padding: 16px; border-bottom: 1px solid var(--line); }
.import-card:last-child { border-bottom: 0; }
.import-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.import-name { display: flex; gap: 10px; min-width: 0; }
.file-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; color: var(--teal); background: var(--teal-soft); }
.file-icon svg { width: 17px; height: 17px; }
.import-name strong { display: block; max-width: 360px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.import-name small { color: var(--text-faint); font-size: 10px; }
.import-stats { display: flex; flex-wrap: wrap; gap: 7px 14px; margin: 11px 0 0 44px; color: var(--text-soft); font-size: 10px; }
.import-stats b { color: var(--text); }
.mapping-details { margin: 11px 0 0 44px; }
.mapping-details summary { cursor: pointer; color: var(--primary); font-size: 10px; font-weight: 700; }
.mapping-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px; margin-top: 8px; }
.mapping-item { padding: 6px 8px; border-radius: 7px; color: var(--text-soft); background: var(--surface-soft); font-size: 10px; }
.mapping-item b { color: var(--text); }

.users-grid { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 13px; }
.user-card { padding: 16px; }
.user-head { display: flex; align-items: center; gap: 10px; }
.user-head .avatar { width: 39px; height: 39px; }
.user-head-info { min-width: 0; flex: 1; }
.user-head strong, .user-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-head strong { font-size: 13px; }
.user-head small { color: var(--text-faint); font-size: 10px; }
.role-pill { padding: 3px 7px; border-radius: 999px; color: #584db8; background: #efedff; font-size: 9px; font-weight: 800; }
.role-pill.employee { color: #4e5c70; background: #f0f2f5; }
.user-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; }
.user-meta div { padding: 9px; border-radius: 8px; background: var(--surface-soft); }
.user-meta span, .user-meta strong { display: block; }
.user-meta span { color: var(--text-faint); font-size: 9px; }
.user-meta strong { margin-top: 2px; font-size: 10px; }
.user-actions { display: flex; gap: 7px; margin-top: 14px; }
.inactive { opacity: .62; }

.audit-list { display: grid; }
.audit-row { display: grid; grid-template-columns: 35px minmax(180px, .8fr) minmax(220px, 1.4fr) 140px; align-items: center; gap: 12px; min-height: 59px; padding: 9px 15px; border-bottom: 1px solid var(--line); }
.audit-row:last-child { border-bottom: 0; }
.audit-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: var(--primary); background: var(--primary-soft); }
.audit-icon svg { width: 15px; height: 15px; }
.audit-person strong, .audit-person small, .audit-action strong, .audit-action small { display: block; }
.audit-person strong, .audit-action strong { font-size: 11px; }
.audit-person small, .audit-action small, .audit-date { color: var(--text-faint); font-size: 10px; }

.telegram-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; padding: 18px; }
.telegram-state { display: flex; gap: 13px; }
.telegram-logo { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 13px; color: #2387c9; background: #eaf6ff; }
.telegram-logo svg { width: 22px; height: 22px; }
.telegram-state h3 { margin: 0 0 4px; font-size: 14px; }
.telegram-state p { margin: 0; color: var(--text-soft); font-size: 11px; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 9px; border-radius: 8px; color: var(--text-soft); background: var(--surface-soft); font-size: 10px; }
.check-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.check-item.ok .check-dot { background: var(--teal); }

.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .38); backdrop-filter: blur(2px); animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } }

.drawer {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    width: min(650px, calc(100vw - 40px));
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .5; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; min-height: 78px; padding: 18px 19px; border-bottom: 1px solid var(--line); }
.drawer-title { min-width: 0; flex: 1; }
.drawer-title h2 { margin: 0 0 4px; overflow: hidden; font-size: 18px; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.drawer-title p { margin: 0; color: var(--text-faint); font-size: 10px; }
.drawer-tabs { display: flex; gap: 4px; padding: 8px 15px 0; border-bottom: 1px solid var(--line); }
.drawer-tab { min-height: 40px; padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; cursor: pointer; color: var(--text-soft); background: transparent; font-size: 11px; font-weight: 700; }
.drawer-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 19px max(24px, env(safe-area-inset-bottom)); }
.drawer-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 19px; border-top: 1px solid var(--line); background: #fbfcfd; }
.detail-section { margin-bottom: 22px; }
.detail-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.detail-section-title h3 { margin: 0; color: #475266; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 14px; }
.detail-value { min-height: 64px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfd; }
.detail-value span, .detail-value strong { display: block; }
.detail-value span { margin-bottom: 5px; color: var(--text-faint); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.detail-value strong { overflow-wrap: anywhere; color: #334055; font-size: 12px; font-weight: 600; }
.detail-value.full { grid-column: 1 / -1; }
.detail-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-form .field { margin: 0; }
.detail-form .full { grid-column: 1 / -1; }
.extra-row { display: grid; grid-template-columns: minmax(130px, .45fr) 1fr auto; gap: 8px; margin-bottom: 8px; }

.status-control { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.status-control .select { flex: 1; }

.comment-compose { margin-bottom: 18px; }
.comment-compose .textarea { min-height: 84px; }
.comment-compose-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.comment { padding: 13px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.comment-head .avatar { width: 27px; height: 27px; border-radius: 8px; font-size: 9px; }
.comment-head strong { font-size: 11px; }
.comment-head time { margin-left: auto; color: var(--text-faint); font-size: 9px; }
.comment p { margin: 0 0 0 35px; color: #465267; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

.timeline-item { position: relative; display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding-bottom: 18px; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 26px; bottom: 0; width: 1px; background: var(--line); }
.timeline-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #d7daf2; border-radius: 8px; color: var(--primary); background: #f4f4ff; }
.timeline-dot svg { width: 12px; height: 12px; }
.timeline-content strong { display: block; margin-top: 2px; font-size: 11px; }
.timeline-content p { margin: 3px 0; color: var(--text-soft); font-size: 11px; }
.timeline-content small { color: var(--text-faint); font-size: 9px; }

.modal-wrap { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.modal { width: min(580px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: hidden; border-radius: 16px; background: #fff; box-shadow: var(--shadow-lg); animation: modalIn .16s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head { display: flex; align-items: center; gap: 10px; min-height: 61px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.modal-head h2 { min-width: 0; flex: 1; margin: 0; font-size: 16px; }
.modal-body { max-height: calc(100vh - 180px); padding: 17px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 17px; border-top: 1px solid var(--line); background: #fbfcfd; }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.permission-item { display: flex; align-items: flex-start; gap: 8px; min-height: 43px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: #4b5669; background: #fbfcfd; font-size: 10px; }
.permission-item input { margin-top: 2px; accent-color: var(--primary); }
.permission-item:has(input:checked) { color: #4849a6; border-color: #c9c9ef; background: #f5f5ff; }

.confirm-copy { color: var(--text-soft); font-size: 12px; }
.confirm-copy strong { color: var(--text); }
.confirm-warning { padding: 10px; margin: 12px 0; border-radius: 8px; color: #9c3c3c; background: var(--red-soft); font-size: 11px; }

.toast-region { position: fixed; z-index: 200; right: 18px; top: 18px; display: grid; width: min(360px, calc(100vw - 36px)); gap: 8px; }
.toast { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 9px; min-height: 53px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 12px 36px rgba(15,23,42,.16); animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-7px); } }
.toast-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--teal); background: var(--teal-soft); }
.toast.error .toast-icon { color: var(--red); background: var(--red-soft); }
.toast-icon svg { width: 14px; height: 14px; }
.toast strong, .toast span { display: block; }
.toast strong { font-size: 11px; }
.toast span { color: var(--text-soft); font-size: 10px; }
.toast button { border: 0; cursor: pointer; color: var(--text-faint); background: transparent; }

.skeleton { position: relative; overflow: hidden; border-radius: 7px; color: transparent !important; background: #edf0f4; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.mobile-bottom-nav { display: none; }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .users-grid { grid-template-columns: repeat(2, minmax(250px, 1fr)); }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 270px; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(15,23,42,.4); }
    .main { margin-left: 0; }
    .mobile-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: 59px; padding: max(9px, env(safe-area-inset-top)) 15px 9px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
    .mobile-header .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
    .mobile-header strong { min-width: 0; flex: 1; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
    .content { padding: 20px 16px 96px; }
    .page-head { min-height: auto; margin-bottom: 17px; }
    .page-head h1 { font-size: 21px; }
    .dashboard-grid, .import-layout { grid-template-columns: 1fr; }
    .mobile-bottom-nav { position: fixed; inset: auto 10px max(10px, env(safe-area-inset-bottom)) 10px; z-index: 40; display: flex; align-items: center; justify-content: space-around; min-height: 61px; padding: 6px; border: 1px solid rgba(222,227,235,.9); border-radius: 17px; background: rgba(255,255,255,.94); box-shadow: 0 14px 45px rgba(15,23,42,.16); backdrop-filter: blur(18px); }
    .mobile-nav-item { display: grid; justify-items: center; gap: 2px; min-width: 57px; padding: 5px; border: 0; border-radius: 11px; cursor: pointer; color: #818b9c; background: transparent; font-size: 9px; font-weight: 700; }
    .mobile-nav-item svg { width: 19px; height: 19px; }
    .mobile-nav-item.active { color: var(--primary); background: var(--primary-soft); }
}

@media (max-width: 680px) {
    body { font-size: 13px; }
    .auth-page { display: block; min-height: 100vh; background: #fff; }
    .auth-visual { min-height: 235px; padding: max(22px, env(safe-area-inset-top)) 22px 26px; }
    .auth-message { margin-top: 34px; }
    .auth-message h1 { margin: 9px 0 10px; font-size: 31px; }
    .auth-message p { font-size: 13px; line-height: 1.55; }
    .auth-foot { display: none; }
    .auth-form-wrap { min-height: auto; padding: 28px 20px max(36px, env(safe-area-inset-bottom)); }
    .auth-form h2 { font-size: 24px; }
    .field-row, .detail-grid, .detail-form, .permission-grid, .mapping-grid, .checks { grid-template-columns: 1fr; }
    .page-head { display: block; }
    .page-head p { max-width: 92%; }
    .page-actions { margin-top: 12px; }
    .page-actions .btn { flex: 1; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .stat-card { min-height: 105px; padding: 14px; }
    .stat-value { font-size: 22px; }
    .toolbar { display: grid; grid-template-columns: 1fr 1fr; padding: 11px; }
    .search-box { grid-column: 1 / -1; min-width: 0; }
    .toolbar .select { width: 100%; min-width: 0; }
    .table-wrap { display: none; }
    .mobile-customer-list { display: grid; }
    .mobile-customer { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; min-height: 72px; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
    .mobile-customer:last-child { border-bottom: 0; }
    .mobile-customer-main { min-width: 0; }
    .mobile-customer-main strong, .mobile-customer-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-customer-main strong { color: var(--text); font-size: 12px; }
    .mobile-customer-main span { margin-top: 2px; color: var(--text-soft); font-size: 10px; }
    .mobile-customer-side { display: grid; justify-items: end; gap: 5px; }
    .mobile-customer-side span:last-child { color: var(--text-faint); font-size: 9px; }
    .table-footer { align-items: flex-start; flex-direction: column; }
    .pagination { width: 100%; justify-content: space-between; }
    .bulk-bar { flex-wrap: wrap; }
    .bulk-bar strong { width: 100%; }
    .bulk-bar .select { flex: 1; width: auto; }
    .users-grid { grid-template-columns: 1fr; }
    .audit-row { grid-template-columns: 31px 1fr auto; gap: 9px; padding: 10px 12px; }
    .audit-action { grid-column: 2 / -1; padding-bottom: 4px; }
    .audit-date { grid-column: 3; grid-row: 1; }
    .telegram-card { grid-template-columns: 1fr; }
    .telegram-card > .btn { width: 100%; }
    .drawer { width: 100vw; }
    .drawer-head { min-height: 70px; padding: max(14px, env(safe-area-inset-top)) 15px 13px; }
    .drawer-tabs { padding-left: 10px; overflow-x: auto; }
    .drawer-body { padding: 15px; }
    .drawer-actions { padding: 11px 15px max(11px, env(safe-area-inset-bottom)); }
    .detail-form .full, .detail-value.full { grid-column: auto; }
    .extra-row { grid-template-columns: 1fr auto; }
    .extra-row .extra-value { grid-column: 1 / -1; grid-row: 2; }
    .modal-wrap { align-items: end; padding: 0; }
    .modal { width: 100%; max-height: calc(100vh - 28px); border-radius: 18px 18px 0 0; }
    .modal-body { max-height: calc(100vh - 165px); }
    .toast-region { top: max(12px, env(safe-area-inset-top)); right: 12px; width: calc(100vw - 24px); }
}

@media (max-width: 390px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 92px; }
    .auth-visual { min-height: 220px; }
    .content { padding-inline: 12px; }
    .mobile-bottom-nav { inset-inline: 7px; }
    .mobile-nav-item { min-width: 50px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

