:root {
    --bg: #f2f4f8;
    --surface: #ffffff;
    --text: #10141c;
    --muted: #7b8394;
    --primary: #1f5cff;
    --danger: #ea1f2d;
    --radius: 18px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1218;
        --surface: #191d26;
        --text: #f2f4f8;
        --muted: #929aad;
    }
}

* { box-sizing: border-box; }

/* Атрибут hidden должен побеждать display у .admin-link и экранов. */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

#app {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
}

.hero {
    background: linear-gradient(135deg, #1f5cff, #0f3fd0);
    color: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 10px 24px rgba(31, 92, 255, .25);
}

.hero__row { display: flex; align-items: center; gap: 14px; }

.hero__avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    display: grid; place-items: center;
    font-size: 28px;
    overflow: hidden;
}

.hero__avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero__greeting { opacity: .85; font-size: 15px; }
.hero__name { font-size: 24px; font-weight: 700; }

.hero__note {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .25);
    font-size: 14px;
    opacity: .9;
}

.admin-link {
    display: block;
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.featured {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin-top: 14px;
    padding: 18px;
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #f5252f, #c40d1a);
    color: #fff;
    text-align: left;
    font: inherit;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(234, 31, 45, .28);
}

.featured__icon {
    width: 54px; height: 54px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .2);
    display: grid; place-items: center;
    font-size: 26px;
}

.featured__title { font-size: 22px; font-weight: 700; }
.featured__sub { font-size: 14px; opacity: .92; }
.featured__chev { margin-left: auto; font-size: 26px; opacity: .8; }

.grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.tile {
    background: var(--surface);
    border: 0;
    border-radius: 16px;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font: inherit;
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 20, 28, .06);
}

.tile:active { transform: scale(.97); }
.tile__icon { font-size: 26px; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(31, 92, 255, .08); }
.tile__title { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.25; }

.topbar { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.topbar__back { border: 0; background: none; font-size: 30px; line-height: 1; color: var(--primary); cursor: pointer; padding: 0 6px 4px 0; }

.page-title { font-size: 24px; margin: 4px 0 16px; }

.form { display: flex; flex-direction: column; gap: 14px; }

.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--danger); }

.field input, .field select, .field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(128, 128, 128, .3);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.field textarea { min-height: 110px; resize: vertical; }
.field--check { display: flex; align-items: center; gap: 10px; }
.field--check input { width: 22px; height: 22px; }
.field--check label { margin: 0; }
.field .error { color: var(--danger); font-size: 13px; margin-top: 4px; }

.btn {
    padding: 15px;
    border: 0;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn[disabled] { opacity: .6; }

.card {
    background: var(--surface);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(16, 20, 28, .06);
}

.list { display: flex; flex-direction: column; gap: 10px; }

.ticket { background: var(--surface); border-radius: 16px; padding: 14px 16px; }
.ticket__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ticket__num { font-weight: 700; }
.ticket__cat { color: var(--muted); font-size: 14px; margin-top: 2px; }
.ticket__body { margin-top: 8px; font-size: 14px; white-space: pre-wrap; }
.ticket__comment { margin-top: 8px; font-size: 14px; padding: 10px; border-radius: 10px; background: rgba(31, 92, 255, .08); }

.badge { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.badge--new { background: rgba(31, 92, 255, .12); color: var(--primary); }
.badge--in_progress { background: rgba(255, 168, 0, .16); color: #b57500; }
.badge--done { background: rgba(23, 168, 90, .14); color: #12854a; }
.badge--rejected { background: rgba(234, 31, 45, .12); color: var(--danger); }

.empty { color: var(--muted); text-align: center; padding: 40px 20px; }

.row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(128, 128, 128, .18); }
.row:last-child { border: 0; }
.row span:first-child { color: var(--muted); }

.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid rgba(128, 128, 128, .2);
    padding-bottom: env(safe-area-inset-bottom);
}

.tab {
    flex: 1;
    border: 0;
    background: none;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font: inherit;
    font-size: 11px;
    color: var(--muted);
    cursor: pointer;
}

.tab span { font-size: 20px; }
.tab.is-active { color: var(--primary); font-weight: 600; }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(90px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    background: rgba(16, 20, 28, .92);
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 14px;
    max-width: 90vw;
    z-index: 10;
}
