:root {
    --green: #2F8A3A;
    --green-dark: #1F6B2C;
    --orange: #E8892C;
    --blue: #3B8FD9;
    --purple: #7B5EA7;
    --bg: #F4F5F7;
    --card: #FFFFFF;
    --ink: #1F2A24;
    --muted: #6B7280;
    --line: #ECEEF1;
    --danger: #E11D48;
    --radius: 18px;
    --shadow: 0 8px 24px rgba(31, 42, 36, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body.app-body {
    font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
    background: #E8EBE9;
    color: var(--ink);
}

.device { min-height: 100dvh; }
.device-shell {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100dvh;
    background: var(--bg);
    position: relative;
    overflow-x: hidden;
}
@media (min-width: 480px) {
    .device { padding: 20px 0; background: #dfe3e0; }
    .device-shell {
        min-height: calc(100dvh - 40px);
        border-radius: 28px;
        box-shadow: 0 20px 50px rgba(0,0,0,.12);
        overflow: auto;
        max-height: calc(100dvh - 40px);
    }
}

.app-header { padding: 16px 20px 8px; background: var(--bg); }
.app-main { padding: 8px 20px 24px; }
.app-main.has-nav { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.flash {
    margin: 0 20px 12px;
    background: #E7F7EA;
    color: #166534;
    border-radius: 14px;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--green);
    font-weight: 800;
    font-size: 28px;
    letter-spacing: -0.05em;
}
.logo svg { width: 28px; height: 28px; }
.tagline { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

.hello { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; margin: 0; }
.loc {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.icon-btns { display: flex; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 14px;
    background: #fff; display: grid; place-items: center;
    text-decoration: none; color: var(--ink); position: relative;
    box-shadow: var(--shadow);
    font-size: 18px;
}
.badge {
    position: absolute; top: 6px; right: 6px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 99px; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 800; display: grid; place-items: center;
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}
.action {
    display: flex; flex-direction: column; justify-content: space-between;
    min-height: 138px; padding: 16px; border-radius: 20px;
    color: #fff; text-decoration: none;
    box-shadow: 0 10px 22px rgba(0,0,0,.08);
}
.action .ico {
    width: 42px; height: 42px; border-radius: 14px;
    background: rgba(255,255,255,.2);
    display: grid; place-items: center; font-size: 22px;
}
.action strong { font-size: 16px; line-height: 1.15; display: block; margin-top: 18px; }
.action small { opacity: .9; font-size: 12px; display: block; margin-top: 4px; }
.action.green { background: linear-gradient(160deg, #3BA84A, #2F8A3A); }
.action.orange { background: linear-gradient(160deg, #F09A3C, #E8892C); }
.action.blue { background: linear-gradient(160deg, #5AA3E6, #3B8FD9); }
.action.purple { background: linear-gradient(160deg, #8E72B8, #7B5EA7); }

.section { margin-top: 26px; }
.section h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: -.02em; }

.opp {
    display: flex; gap: 12px; align-items: center;
    background: #fff; border-radius: 16px; padding: 12px;
    box-shadow: var(--shadow); text-decoration: none; color: inherit;
    margin-bottom: 10px;
}
.thumb {
    width: 52px; height: 52px; border-radius: 14px;
    display: grid; place-items: center; font-size: 26px; flex: 0 0 auto;
    background: #EEF6EF;
}
.opp .meta { flex: 1; min-width: 0; }
.opp .meta b { display: block; font-size: 14px; }
.opp .meta span { color: var(--muted); font-size: 12px; }
.pill {
    background: #E7F7EA; color: var(--green-dark);
    border-radius: 999px; padding: 6px 10px;
    font-size: 12px; font-weight: 800; white-space: nowrap;
}
.pill.orange { background: #FFF4E5; color: #B45309; }

.tabbar {
    position: sticky; bottom: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
    z-index: 30;
}
.device-shell { display: flex; flex-direction: column; }
.tabbar-fixed {
    position: fixed; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 430px;
    bottom: 0;
}
.tabbar a {
    text-align: center; text-decoration: none; color: #9AA3A0;
    font-size: 11px; font-weight: 700; position: relative;
}
.tabbar a .i { font-size: 20px; display: block; line-height: 1.2; }
.tabbar a.active { color: var(--green); }
.tabbar .dot {
    position: absolute; top: 0; right: 28%;
    width: 8px; height: 8px; background: var(--danger); border-radius: 99px;
}

label span { display:block; font-size:13px; font-weight:700; margin: 0 0 6px; color:#374151; }
.app-main input:not([type=checkbox]):not([type=hidden]):not([type=radio]),
.app-main select, .app-main textarea {
    width: 100%; border: 1px solid #E5E7EB; background: #fff;
    border-radius: 14px; padding: 14px 14px; font-size: 16px; outline: none;
    font-family: inherit;
}
.app-main input:focus, .app-main select:focus, .app-main textarea:focus {
    border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,138,58,.15);
}
.btn {
    display:block; width:100%; text-align:center; border:0; border-radius:14px;
    padding: 15px 16px; font-size: 15px; font-weight: 800; letter-spacing:.02em;
    text-decoration:none; cursor:pointer; font-family: inherit;
}
.btn-green { background: var(--green); color:#fff; }
.btn-orange { background: var(--orange); color:#fff; }
.btn-blue { background: var(--blue); color:#fff; }
.btn-purple { background: var(--purple); color:#fff; }
.btn-ghost { background:#fff; color: var(--ink); border: 1px solid var(--line); }
.back { color: var(--green); font-weight: 700; text-decoration: none; font-size: 14px; }

.welcome-hero {
    padding: 28px 8px 10px; text-align: center;
}
.welcome-hero p { color: var(--muted); }

.profile-head {
    background: var(--green); color: #fff; margin: -8px -20px 16px;
    padding: 28px 20px 24px; text-align: center;
}
.avatar {
    width: 84px; height: 84px; border-radius: 50%;
    background: #fff; margin: 0 auto 10px;
    display: grid; place-items: center; font-size: 40px;
    border: 3px solid rgba(255,255,255,.5);
}
.menu {
    background: #fff; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow);
}
.menu a, .menu button {
    display: flex; width: 100%; align-items: center; gap: 12px;
    padding: 14px 16px; background: #fff; border: 0; border-bottom: 1px solid var(--line);
    text-align: left; font-size: 15px; font-weight: 600; color: var(--ink);
    text-decoration: none; font-family: inherit; cursor: pointer;
}
.menu a:last-child, .menu form:last-child button { border-bottom: 0; }

.chat-wrap {
    background: #ECE5DD; border-radius: 16px; min-height: 460px;
    display: flex; flex-direction: column; overflow: hidden;
}
.chat-top {
    background: #075E54; color: #fff; padding: 12px 14px;
    display: flex; align-items: center; gap: 10px;
}
.robot {
    width: 38px; height: 38px; border-radius: 50%; background: #fff;
    display: grid; place-items: center; font-size: 22px;
}
.bubble { max-width: 82%; padding: 10px 12px; font-size: 14.5px; white-space: pre-line; }
.me { align-self: flex-end; background: #DCF8C6; border-radius: 14px 14px 4px 14px; }
.bot { align-self: flex-start; background: #fff; border-radius: 14px 14px 14px 4px; }

[x-cloak] { display: none !important; }

.hermes-root.float { position: static; }
.hermes-fab {
    position: fixed;
    right: max(16px, calc(50% - 215px + 16px));
    bottom: calc(86px + env(safe-area-inset-bottom));
    z-index: 40;
    border: 0;
    background: var(--green);
    color: #fff;
    border-radius: 999px;
    padding: 10px 14px 10px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-family: inherit;
    box-shadow: 0 10px 24px rgba(47,138,58,.35);
    cursor: pointer;
}
.hermes-fab.hidden { display: none; }
.hermes-fab-face {
    width: 36px; height: 36px; border-radius: 50%;
    background: #fff; color: #111; display: grid; place-items: center; font-size: 20px;
}
.hermes-panel {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: min(100%, 430px);
    bottom: 0;
    z-index: 45;
    height: min(78dvh, 640px);
    background: #ECE5DD;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -12px 40px rgba(0,0,0,.18);
    border-radius: 20px 20px 0 0;
    overflow: hidden;
}
.hermes-root.page .hermes-panel {
    position: relative;
    left: auto;
    transform: none;
    width: 100%;
    height: min(62dvh, 560px);
    border-radius: 16px;
    box-shadow: var(--shadow);
}
.hermes-thread {
    flex: 1;
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.hermes-composer {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #f0f0f0;
}
.hermes-composer input {
    flex: 1;
    border-radius: 22px !important;
    padding: 10px 14px !important;
    border: 0 !important;
}
.hermes-composer .btn { width: auto; border-radius: 22px; padding: 10px 16px; }
.hermes-close {
    background: transparent; border: 0; color: #fff;
    font-size: 18px; cursor: pointer;
}
