:root {
    --bg: #f2f5f8;
    --panel: #ffffff;
    --border: #dde4ea;
    --text: #0f172a;
    --muted: #64748b;
    --brand: #0a5d73;
    --brand-dark: #07495b;
    --ok: #0ea5a4;
    --danger: #b91c1c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", "Inter", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    border-right: 1px solid var(--border);
    background: #f8fbfd;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    gap: 24px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px;
}

.brand-logo {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.brand-title {
    font-size: 16px;
}

.brand-sub {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    padding: 10px 12px;
    border-radius: 8px;
    color: #334155;
    border: 1px dashed transparent;
    transition: 0.2s;
}

.nav-link:hover {
    background: #e9f0f5;
}

.nav-link.active {
    background: #eef6fb;
    border-color: #9ac3da;
    border-left: 3px solid var(--brand);
    color: #0f3b4b;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.main-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 68px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 18px;
}

.topbar-search-wrap {
    width: min(440px, 65%);
}

.topbar-search {
    width: 100%;
    height: 38px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: #f7fafc;
    padding: 0 12px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.15;
}

.admin-identity strong {
    font-size: 13px;
}

.admin-identity span {
    color: var(--muted);
    font-size: 11px;
}

.topbar-action {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #d9f1ff;
    color: var(--brand);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
}

.page-content {
    padding: 22px;
}

.page-header {
    margin-bottom: 16px;
}

.page-header.actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.eyebrow {
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

h2 {
    font-size: 42px;
    line-height: 1;
    margin-bottom: 6px;
}

.muted {
    color: var(--muted);
}

.dash-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}

.dash-grid.two-col {
    grid-template-columns: 1.7fr 1fr;
}

.metric-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 16px;
}

.metric-card h3 {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.metric-card.highlighted {
    background: linear-gradient(145deg, var(--brand), #0b738e);
    color: #fff;
}

.metric-card.highlighted h3,
.metric-card.highlighted .metric-label {
    color: #d8f3ff;
}

.metric-value {
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

.metric-label {
    color: #4b5563;
    font-size: 13px;
}

.panel-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 16px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.badge {
    font-size: 11px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #ecf4f8;
    color: #075985;
    font-weight: 700;
}

.map-wrap {
    background: #edf2f7;
    border-radius: 10px;
    border: 1px solid #d3dce5;
    min-height: 250px;
    position: relative;
    overflow: hidden;
}

.map-wrap .world-svg {
    width: 100%;
    height: 100%;
}

.map-pin {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand);
    border: 2px solid #c4f0ff;
    box-shadow: 0 0 0 8px rgba(10, 93, 115, 0.12);
}

.region-stats {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.region-pill {
    background: #f8fbfd;
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand);
    border-radius: 8px;
    padding: 9px;
}

.region-pill strong {
    display: block;
    font-size: 12px;
}

.registration-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reg-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.reg-item p {
    font-size: 12px;
    color: var(--muted);
}

.users-layout {
    grid-template-columns: 280px 1fr;
}

.filter-card h3,
.table-card h3 {
    margin-bottom: 10px;
}

.field-label {
    display: block;
    margin-top: 10px;
    margin-bottom: 6px;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
}

.field-control {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
}

textarea.field-control {
    height: auto;
    padding: 10px;
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-text,
.btn-icon {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
    padding: 10px 14px;
}

.btn-primary:hover {
    background: var(--brand-dark);
}

.btn-secondary {
    background: #eef2f6;
    color: #0f172a;
    padding: 10px 14px;
    border: 1px solid var(--border);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
    padding: 10px 14px;
}

.btn-text {
    background: transparent;
    color: var(--brand);
    margin-top: 14px;
}

.btn-icon {
    background: #eef2f6;
    width: 28px;
    height: 28px;
}

.is-disabled {
    opacity: 0.58;
    cursor: not-allowed !important;
}

.table-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.table-wrap {
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 10px 8px;
    font-size: 13px;
    vertical-align: top;
}

.data-table th {
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.user-meta {
    color: var(--muted);
    font-size: 12px;
}

.status-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status-chip.active {
    background: #dcfce7;
    color: #166534;
}

.status-chip.expired {
    background: #fee2e2;
    color: #991b1b;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: grid;
    place-items: center;
    z-index: 100;
    padding: 14px;
}

.modal.hidden {
    display: none;
}

.modal-card {
    width: min(720px, 96vw);
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 16px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.form-grid.two {
    grid-template-columns: 1fr 1fr;
}

.span-2 {
    grid-column: span 2;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.mt-16 {
    margin-top: 16px;
}

.coupon-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coupon-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.coupon-item .code {
    font-family: Consolas, monospace;
    font-weight: 700;
}

.hidden {
    display: none !important;
}

.readonly-notice {
    margin-bottom: 14px;
    border: 1px solid #f5d0a5;
    background: #fff7ed;
    color: #9a3412;
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 600;
}

.settings-layout {
    grid-template-columns: 1fr 1.7fr;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.compact-grid {
    margin-top: 6px;
}

.perm-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.perm-box input[type="checkbox"] {
    accent-color: var(--brand);
}

.change-credit {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 999;
    background: rgba(15, 31, 42, 0.94);
    color: #ffffff;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.change-credit.visible {
    opacity: 1;
    transform: translateY(0);
}

.metrics-grid-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.line-chart-wrap,
.bar-chart-wrap {
    min-height: 280px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, #fcfeff, #f6fafc);
    padding: 14px;
}

.line-chart-svg {
    width: 100%;
    height: 250px;
}

.line-chart-polyline {
    fill: none;
    stroke: #0b7e90;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.line-chart-dot {
    fill: #0b7e90;
}

.line-chart-label {
    fill: #64748b;
    font-size: 10px;
    font-weight: 600;
}

.bar-chart-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bar-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
}

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: #e7eef3;
    border: 1px solid #d2dee8;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0a5d73, #0ea5a4);
}

.enterprise-layout {
    grid-template-columns: 1fr 1.35fr;
}

.slim-control {
    max-width: 320px;
}

.details-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-grid {
    display: grid;
    gap: 10px;
}

.detail-grid.two {
    grid-template-columns: 1fr 1fr;
}

.detail-item {
    background: #f8fbfd;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.detail-item span {
    color: var(--muted);
    font-size: 12px;
}

.detail-item strong {
    font-size: 14px;
}

.detail-item.interactive {
    cursor: pointer;
    transition: background 0.2s ease;
}

.detail-item.interactive:hover {
    background: #eef6fb;
}

.password-box {
    border: 1px dashed #b8c8d6;
    background: #f8fbfd;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.masked-password {
    letter-spacing: 0.22em;
}

.inline-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.danger-box {
    border: 1px solid #fecaca;
    background: #fff7f7;
    border-radius: 10px;
    padding: 12px;
}

.members-wrap {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.members-wrap h4 {
    margin-bottom: 8px;
}

@media (max-width: 1100px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        gap: 12px;
    }

    .sidebar-footer {
        margin-top: 0;
        flex-direction: row;
    }

    .dash-grid.two-col,
    .users-layout,
    .metrics-grid-6,
    .enterprise-layout {
        grid-template-columns: 1fr;
    }

    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }
}

/* Ultra Premium UI Layer */
:root {
    --bg: #f2eee7;
    --panel: rgba(255, 255, 255, 0.92);
    --border: rgba(147, 117, 76, 0.22);
    --text: #1f2b36;
    --muted: #687a89;
    --brand: #145c6b;
    --brand-dark: #0f4a56;
    --ok: #0a8b78;
    --danger: #b42318;
}

body {
    font-family: "Manrope", "Plus Jakarta Sans", "Segoe UI", sans-serif;
    background:
        radial-gradient(1200px 600px at 90% -10%, rgba(255, 201, 117, 0.15), transparent 60%),
        radial-gradient(1000px 700px at -10% 0%, rgba(20, 92, 107, 0.14), transparent 65%),
        linear-gradient(180deg, #f7f2ea, #f1ece3 60%, #ece5d8);
}

.sidebar {
    background: linear-gradient(180deg, #0f1f2a, #14293a);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f9c881, #b57e32);
    color: #222;
    font-weight: 800;
}

.brand-title {
    color: #ecf4ff;
    font-weight: 700;
}

.brand-sub {
    color: rgba(221, 233, 247, 0.74);
}

.nav-link {
    color: rgba(226, 238, 250, 0.88);
    border: 1px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.09);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(20, 92, 107, 0.5), rgba(181, 126, 50, 0.26));
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-left: 3px solid #f8cb89;
}

.topbar {
    height: 74px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(147, 117, 76, 0.2);
}

.topbar-search {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(147, 117, 76, 0.26);
    border-radius: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f9c881, #b57e32);
    color: #1f2b36;
}

h2 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.metric-card,
.panel-card,
.modal-card {
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 14px 30px rgba(74, 52, 26, 0.1);
}

.metric-card {
    border-radius: 16px;
}

.metric-card:hover,
.panel-card:hover {
    transform: translateY(-2px);
    transition: transform 0.24s ease, box-shadow 0.24s ease;
    box-shadow: 0 18px 36px rgba(74, 52, 26, 0.14);
}

.metric-card.highlighted {
    background: linear-gradient(135deg, #145c6b, #0a8b78);
}

.badge {
    background: linear-gradient(135deg, rgba(20, 92, 107, 0.14), rgba(181, 126, 50, 0.16));
    color: #1f4758;
    border: 1px solid rgba(20, 92, 107, 0.18);
}

.field-control {
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(147, 117, 76, 0.26);
}

.field-control:focus {
    outline: none;
    border-color: rgba(20, 92, 107, 0.48);
    box-shadow: 0 0 0 3px rgba(20, 92, 107, 0.12);
}

.btn-primary {
    background: linear-gradient(135deg, #145c6b, #0f4a56);
    box-shadow: 0 10px 20px rgba(20, 92, 107, 0.24);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0f4a56, #0b3942);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(147, 117, 76, 0.28);
}

.btn-danger {
    background: linear-gradient(135deg, #fee4e2, #ffd9d5);
    border: 1px solid #fecaca;
}

.line-chart-wrap,
.bar-chart-wrap {
    border-radius: 16px;
    background:
        radial-gradient(circle at 80% -10%, rgba(20, 92, 107, 0.11), transparent 48%),
        linear-gradient(180deg, #ffffff, #f8f2e8);
}

.line-chart-polyline {
    stroke: #145c6b;
    stroke-width: 3.5;
}

.line-chart-dot {
    fill: #145c6b;
}

.bar-track {
    background: rgba(20, 92, 107, 0.1);
    border: 1px solid rgba(20, 92, 107, 0.2);
}

.bar-fill {
    background: linear-gradient(90deg, #145c6b, #b57e32);
}

.detail-item,
.password-box,
.members-wrap,
.danger-box,
.auto-code-banner,
.auto-code-preview {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    border: 1px solid rgba(147, 117, 76, 0.24);
}

.auto-code-banner {
    padding: 12px 14px;
    margin-bottom: 12px;
    color: #1f4758;
    border-left: 4px solid #b57e32;
}

.auto-code-preview {
    margin-top: 12px;
    padding: 10px 12px;
    color: #145c6b;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.coupon-item {
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(147, 117, 76, 0.24);
}

.coupon-item .code {
    color: #145c6b;
}

.coupon-item.interactive {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.coupon-item.interactive:hover,
.coupon-item.interactive:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(20, 92, 107, 0.42);
    box-shadow: 0 8px 18px rgba(20, 92, 107, 0.14);
}

.coupon-item-hint {
    margin-top: 4px;
    font-size: 12px;
}

.coupon-manage-note {
    margin-bottom: 10px;
}

.coupon-manage-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.coupon-manage-status {
    min-height: 22px;
    margin-top: 12px;
    font-weight: 600;
}

@media (max-width: 1100px) {
    .coupon-manage-summary {
        grid-template-columns: 1fr;
    }

    .settings-layout,
    .permissions-grid {
        grid-template-columns: 1fr;
    }
}
