:root {
    --green: #0e6b3c;
    --green-dark: #0a4d2b;
    --gold: #c4a15a;
    --orange: #f36b12;
    --orange-deep: #e25a08;
    --ink: #1c2b24;
    --paper: #f7f7f7;
}

body {
    font-family: "Nirmala UI", "Mangal", "Segoe UI", sans-serif;
    background: var(--paper);
    color: var(--ink);
}

.nocopy {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.nocopy input,
.nocopy textarea,
.nocopy select {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

.app-phone {
    width: min(480px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    background: #fff;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.app-phone.wide {
    width: min(1040px, 100%);
}

.appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    min-height: 56px;
    padding: 0.35rem 0.4rem;
    color: #fff;
    background: linear-gradient(180deg, #ff9a33 0%, #f36b12 100%);
}

.appbar h1 {
    margin: 0;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
}

.appbar-side {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
}

.brand-dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    font-weight: 700;
    font-size: 1rem;
}

.appbar-symbol {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    justify-self: end;
}

.home-total {
    text-align: center;
    color: #66756c;
    margin: 0.85rem 0 0;
}

.home-total strong {
    color: var(--ink);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.35rem 0.4rem;
    padding: 1.1rem 0.65rem 0.4rem;
    text-align: center;
}

.app-tile {
    color: var(--ink);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    line-height: 1.25;
}

.app-ico {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.55rem;
    background: linear-gradient(180deg, #ff9a3d, #f36b12);
    box-shadow: 0 8px 16px rgba(243, 107, 18, 0.28);
}

.app-ico b {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    background: #fff;
    color: var(--orange-deep);
    border: 1px solid #ffd7bf;
    font-size: 0.68rem;
    line-height: 20px;
}

.site-footer {
    text-align: center;
    font-size: 0.75rem;
    color: #7d7d7d;
    background: #fff;
    padding: 0.45rem 0.6rem calc(0.45rem + env(safe-area-inset-bottom));
}

.site-footer a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.app-phone .site-footer {
    padding-bottom: 0.2rem;
}

.tabbar {
    position: sticky;
    bottom: 0;
    display: flex;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom));
    z-index: 20;
}

.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    color: #8a8a8a;
    text-decoration: none;
    font-size: 0.72rem;
}

.tabbar a i {
    font-size: 1.2rem;
}

.tabbar a.active {
    color: var(--orange-deep);
}

.search-panel {
    margin-bottom: 0.8rem;
}

.search-line {
    display: flex;
    gap: 0.45rem;
}

.search-line .btn {
    white-space: nowrap;
}

.search-panel summary {
    color: #66756c;
    cursor: pointer;
}

.btn-orange {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
}

.btn-orange:hover {
    background: var(--orange-deep);
    border-color: var(--orange-deep);
    color: #fff;
}

.voter-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.voter-card {
    border: 1px solid #f0f0f0;
    border-radius: 16px;
    padding: 0.85rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}

.voter-top {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: flex-start;
}

.voter-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.edit-link {
    color: var(--green-dark);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.voter-name {
    font-weight: 700;
    font-size: 1.02rem;
}

.voter-meta,
.voter-sub,
.voter-place {
    color: #66756c;
    font-size: 0.84rem;
}

.voter-place {
    margin-top: 0.35rem;
    color: var(--ink);
}

.wa-share {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #25d366;
    color: #fff;
    font-size: 1.2rem;
    flex: 0 0 40px;
}

.mark-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    margin: 0.7rem 0 0.45rem;
}

.mark-btn {
    border: 1px solid #e6e6e6;
    background: #fff;
    border-radius: 999px;
    min-height: 38px;
    font-size: 0.78rem;
    padding: 0.25rem 0.2rem;
}

.mark-btn.ours.on {
    background: #0e6b3c;
    border-color: #0e6b3c;
    color: #fff;
}

.mark-btn.opp.on {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
}

.mark-btn.none.on {
    background: #5c6770;
    border-color: #5c6770;
    color: #fff;
}

.empty-note {
    color: #66756c;
    text-align: center;
    padding: 1.5rem 0.5rem;
}

.split {
    display: grid;
    gap: 1rem;
}

.group-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
    color: var(--orange-deep);
    font-weight: 700;
    text-decoration: none;
}

.split.has-selection .split-list,
.split:not(.has-selection) .split-voters {
    display: none;
}

@media (min-width: 992px) {
    .app-shell .voter-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 250px;
    background: var(--green-dark);
    color: #fff;
    flex-direction: column;
    padding: 1.25rem 0.9rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    color: #fff;
    text-decoration: none;
    margin-bottom: 1.5rem;
    padding: 0 0.4rem;
}

.brand small,
.brand strong {
    display: block;
}

.brand small {
    opacity: 0.75;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--gold);
    color: var(--green-dark);
    font-weight: 700;
    font-size: 1.3rem;
}

.brand-mark.lg {
    width: 64px;
    height: 64px;
    font-size: 2rem;
    margin: 0 auto 1rem;
}

.sidebar nav a {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    margin-bottom: 0.2rem;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.main {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.9rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e4ece6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-weight: 700;
}

.user-chip {
    text-align: right;
    line-height: 1.2;
}

.user-chip span {
    display: block;
    color: #66756c;
    font-size: 0.82rem;
}

.content {
    padding: 0.85rem 0.85rem 1rem;
    flex: 1;
}

.stat-card,
.card {
    background: #fff;
    border: 1px solid #e4ece6;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(14, 107, 60, 0.04);
}

.stat-card {
    padding: 1rem 1.1rem;
}

.stat-card span {
    display: block;
    color: #66756c;
    font-size: 0.85rem;
}

.stat-card strong {
    font-size: 1.7rem;
    color: var(--green-dark);
}

.stat-card.ours strong { color: #0e6b3c; }
.stat-card.opp strong { color: #a12626; }
.stat-card.neutral strong { color: #5c6770; }

.card-header {
    background: transparent;
    font-weight: 700;
    border-bottom: 1px solid #e4ece6;
}

.table > :not(caption) > * > * {
    background: transparent;
}

.login-stage {
    width: min(440px, 100%);
}

.login-stage .login-card {
    width: 100%;
}

.login-banner {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    background: #fff;
    border-radius: 18px;
    margin-bottom: 0.9rem;
    box-shadow: 0 12px 30px rgba(90, 28, 0, 0.22);
}

.login-symbol {
    width: 72px;
    height: 72px;
    object-fit: contain;
    background: #fff;
    border-radius: 16px;
    margin: 0 auto 0.8rem;
}

.login-wrap {
    min-height: calc(100vh - 2.5rem);
    display: grid;
    place-items: center;
    padding: 1.4rem 1rem 1.6rem;
    background:
        radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.28), transparent 28%),
        radial-gradient(circle at 90% 80%, rgba(14, 107, 60, 0.18), transparent 32%),
        linear-gradient(165deg, #ff9a33 0%, #f36b12 42%, #c44712 100%);
}

.login-card {
    width: min(440px, 100%);
    background: #fffdf9;
    border-radius: 24px;
    padding: 1.35rem 1.35rem 1.6rem;
    text-align: center;
    box-shadow: 0 22px 50px rgba(90, 28, 0, 0.28);
    position: relative;
    overflow: hidden;
}

.login-flag {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    height: 8px;
    margin: -1.35rem -1.35rem 1.15rem;
}

.login-flag span:nth-child(1) { background: #ff8a1e; }
.login-flag span:nth-child(2) { background: #fff; }
.login-flag span:nth-child(3) { background: #138a4b; }

.login-kicker {
    margin: 0 0 0.2rem;
    color: #c44712;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 0.82rem;
}

.login-lead {
    margin: 0;
    color: #66756c;
}

.login-card h1 {
    font-size: 1.55rem;
    margin: 0 0 0.25rem;
    color: #1c2b24;
}

.login-card .form-control:focus {
    border-color: #f36b12;
    box-shadow: 0 0 0 0.2rem rgba(243, 107, 18, 0.18);
}

.shortcut-ask {
    margin-bottom: 0.9rem;
}

.shortcut-card {
    background: #fff8f2;
    border: 1px solid #ffd7b8;
    border-radius: 16px;
    padding: 0.9rem;
}

.shortcut-card strong {
    display: block;
    margin-bottom: 0.25rem;
}

.shortcut-card p {
    margin: 0 0 0.7rem;
    color: #5c5148;
    font-size: 0.92rem;
}

.btn-success {
    background: var(--green);
    border-color: var(--green);
}

.btn-success:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
}

.group-list {
    max-height: 70vh;
    overflow: auto;
}

.group-item {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #eef3ef;
}

.group-item.active,
.group-item:hover {
    background: #eef7f1;
}

.group-item span {
    min-width: 0;
}

.mobile-nav a {
    display: block;
    padding: 0.75rem 0.2rem;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid #eef3ef;
}

.mark-cell {
    min-width: 230px;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.panel-symbol {
    width: 88px;
    height: 88px;
    object-fit: contain;
    flex: 0 0 88px;
    background: #fff;
    border: 1px solid #e4ece6;
    border-radius: 14px;
}

.symbol-thumb {
    width: 36px;
    height: 36px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e4ece6;
    border-radius: 8px;
}

.panel-banner {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e4ece6;
    border-radius: 14px;
    margin-bottom: 1.35rem;
}

@media (max-width: 991.98px) {
    .user-chip span {
        display: none;
    }
    .content {
        padding: 0.9rem;
    }
    .mark-cell {
        min-width: 210px;
    }
}
