/* OptiShare design system — inspired by OptiControl
   Colors, spacing, components, layouts. */

:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #0a0e1a;
    --text-muted: #6b7280;
    --text-soft: #9ca3af;
    --primary: #0a0e1a;
    --primary-hover: #1f2937;
    --accent: #10b981;
    --accent-soft: #d1fae5;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --shadow-sm: 0 1px 2px rgba(10, 14, 26, 0.04);
    --shadow: 0 1px 3px rgba(10, 14, 26, 0.08), 0 1px 2px rgba(10, 14, 26, 0.04);
    --shadow-lg: 0 4px 12px rgba(10, 14, 26, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
}

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

a {
    color: var(--text);
    text-decoration: none;
}

h1, h2, h3, h4 {
    margin: 0 0 0.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 1rem; }

code {
    background: var(--bg);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    border: 1px solid var(--border);
}

/* ---------- App shell (sidebar layout) ---------- */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
}

.sidebar .logo {
    padding: 0 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    color: var(--text);
}

.sidebar .logo img {
    height: 40px;
    width: auto;
}

.sidebar nav {
    flex: 1;
    padding: 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.sidebar .nav-item .nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.sidebar .nav-item .nav-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar .nav-item:hover {
    color: var(--text);
}

.sidebar .nav-item.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.sidebar .nav-item.active .nav-icon {
    background: #d4a44a;
    color: #fff;
}

.sidebar .user-card {
    margin-top: auto;
    padding: 1rem 1rem 0.75rem;
    margin: auto 0.75rem 0.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar .user-card .user-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.sidebar .user-card .user-meta {
    min-width: 0;
    flex: 1;
}

.sidebar .user-card .avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar .user-card .user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .user-card .user-role {
    font-size: 0.65rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .user-card .signout {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    padding: 0.25rem 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    letter-spacing: 0;
    text-transform: none;
}

.sidebar .user-card .signout svg {
    width: 18px;
    height: 18px;
    padding: 8px;
    box-sizing: content-box;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    flex-shrink: 0;
}

.sidebar .user-card .signout:hover {
    color: var(--text);
}

.sidebar .user-card .signout:hover svg {
    background: var(--bg);
}

/* ---------- Main content ---------- */
.content {
    padding: 2rem 2.5rem;
    max-width: 100%;
    overflow-x: auto;
}

.page-header {
    margin-bottom: 1.5rem;
}

.breadcrumb {
    color: var(--text-soft);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.page-header h1 {
    margin: 0;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.card-link {
    display: block;
    color: inherit;
    transition: box-shadow 0.15s, transform 0.15s;
}

.card-link:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.card-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.card-value .unit {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.card-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.card-accent {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
}

.card-accent .card-title,
.card-accent .card-sub {
    color: rgba(255, 255, 255, 0.85);
}

.card-accent .card-value {
    color: #fff;
}

/* Stat card with icon */
.card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.card-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.card-accent .card-icon {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Quick-access / entity card (OptiControl "site" style) */
.entity-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.entity-card .entity-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.entity-card .entity-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.entity-card .entity-title {
    flex: 1;
    min-width: 0;
}

.entity-card .entity-title h3 {
    margin: 0 0 0.1rem;
    font-size: 0.95rem;
}

.entity-card .entity-title .entity-sub {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.entity-card .entity-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
}

.entity-card .entity-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.entity-card .entity-row .label {
    color: var(--text-muted);
}

.entity-card .entity-row .value {
    color: var(--text);
    font-weight: 600;
}

/* ---------- Stat grid ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* ---------- Forms ---------- */
form p {
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

form label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form input[type="tel"],
form input[type="url"],
form select,
form textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

form select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Address autocomplete dropdown */
#address-suggestions {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    margin: 0; padding: 0;
    list-style: none;
    box-shadow: var(--shadow-lg);
    max-height: 220px;
    overflow-y: auto;
}
#address-suggestions li {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
#address-suggestions li:last-child { border-bottom: none; }
#address-suggestions li:hover { background: var(--bg); }

form input::placeholder,
form textarea::placeholder {
    color: var(--text-soft);
}

form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(10, 14, 26, 0.08);
}

form .helptext {
    color: var(--text-muted);
    font-size: 0.8rem;
}

form ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
    color: var(--danger);
    font-size: 0.85rem;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    letter-spacing: 0.02em;
}

button:hover,
.button:hover {
    background: var(--primary-hover);
}

/* Legacy compat */
.horizon-switch { display: none; }

.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: inherit;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
}

.button-secondary:hover {
    background: var(--bg);
}

.button-block {
    width: 100%;
}

/* ---------- Public layout (login/signup/landing) ---------- */
.public-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    background: var(--bg);
}

.public-page {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.public-header {
    text-align: center;
    margin-bottom: 2rem;
}

.public-header .brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.public-header .brand img {
    height: 64px;
    width: auto;
}

.public-header h1 {
    font-size: 2.25rem;
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.public-header .lead,
.public-header p {
    color: var(--text-muted);
    text-align: center;
    font-size: 1.125rem;
    margin: 0;
}

.public-card {
    width: 100%;
    background: var(--surface);
    padding: 3rem 3.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    font-size: 1.0625rem;
}

.public-card h1 {
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.public-card h2 {
    font-size: 1.375rem;
}

.public-card .lead {
    color: var(--text-muted);
    text-align: center;
    font-size: 1.0625rem;
    margin-bottom: 1.5rem;
}

.public-card p,
.public-card label {
    font-size: 1.0625rem;
}

.public-card .footer-link,
.public-page > .footer-link {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.public-card .footer-link a {
    color: var(--text);
    font-weight: 600;
}

/* ---------- Landing hero ---------- */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--text-muted);
    font-size: 1rem;
}

.cta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.cta .card {
    text-align: left;
}

.cta .card h2 {
    margin-bottom: 0.5rem;
}

.cta .card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------- Social auth buttons ---------- */
.social-auth {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.social-auth .button {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    font-weight: 500;
}

.social-auth .button:hover {
    background: var(--bg);
}

.social-auth .button svg {
    width: 18px;
    height: 18px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    color: var(--text-soft);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ---------- Wizard ---------- */
.wizard {
    max-width: 560px;
    margin: 0 auto;
}

.wizard-step {
    color: var(--text-soft);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.wizard h1 {
    margin-bottom: 0.5rem;
}

.wizard .lead {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ---------- Status badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-success { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.badge-warning { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.badge-danger  { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.badge-info    { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }

/* ---------- Horizon switch (pill toggle) ---------- */
.seg-control {
    display: inline-flex;
    align-items: center;
    position: relative;
    padding: 3px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.seg-control__pill {
    position: absolute;
    top: 3px;
    left: 3px;
    height: calc(100% - 6px);
    width: 0;
    background: var(--primary);
    border-radius: 999px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 0;
}
.seg-control__opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color 0.25s;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}
.seg-control__opt:hover { color: var(--text); }
.seg-control__opt.is-active { color: #ffffff; }

/* ---------- Toggle switch ---------- */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: #283149;
}
.switch input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    background: #d1d5db;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.15s;
    margin: 0;
    flex: 0 0 auto;
}
.switch input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.switch input[type="checkbox"]:checked {
    background: #10b981;
}
.switch input[type="checkbox"]:checked::after {
    transform: translateX(16px);
}

/* ---------- Messages (Django) ---------- */
.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.messages li {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-size: 0.9rem;
}

.messages li.error,
.messages li.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.messages li.success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

/* ---------- Tables / KV grids ---------- */
.kv {
    display: grid;
    grid-template-columns: minmax(140px, max-content) 1fr;
    gap: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.kv dt {
    color: var(--text-muted);
    font-weight: 500;
}

.kv dd {
    margin: 0;
    color: var(--text);
}

/* ---------- Section utilities ---------- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1rem;
}

.section-header h2 { margin: 0; }

.empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

/* ---------- Chart wrapper ---------- */
.chart-wrap {
    position: relative;
    height: 320px;
}

/* ---------- Community members grid ---------- */
.members-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 700px) {
    .members-grid { grid-template-columns: 1fr; }
}

.members-col-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}
.members-col-title--producer { border-color: #10b981; color: #047857; }
.members-col-title--consumer { border-color: #3b82f6; color: #1d4ed8; }

.member-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.member-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.member-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.member-site {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}
.member-site--empty {
    color: var(--text-muted);
    font-style: italic;
    border-top: none;
}
.member-site-ref { color: var(--text); }
.member-site-key {
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}
.member-add-site-form {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    align-items: center;
}
.member-add-site-select {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
}
.member-add-site-input {
    width: 60px;
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
}

/* ---------- Hamburger toggle (hidden on desktop) ---------- */
.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-toggle:hover {
    background: var(--bg);
}

.sidebar-overlay {
    display: none;
}

/* ---------- Mobile responsive: sidebar collapse ---------- */
@media (max-width: 768px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
    }

    .app-shell.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99;
        background: rgba(0, 0, 0, 0.3);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .app-shell.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .page-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem;
    }

    .page-header h1 {
        width: 100%;
    }

    .content {
        padding: 1.25rem 1rem;
    }
}

/* ---------- Collapsible details ---------- */
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible-arrow { transition: transform 0.2s ease; }
.collapsible[open] .collapsible-arrow { transform: rotate(90deg); }

/* ---------- Profile page ---------- */
.profile-page {
    max-width: 720px;
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.profile-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.profile-hero-info h2 {
    color: #fff;
    margin: 0 0 0.25rem;
}

.profile-hero-info .badge {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
}

.profile-confirmed-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    color: #065f46;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.profile-section {
    margin-bottom: 1rem;
}

.profile-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
}

.profile-confirm-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ---------- Admin user table ---------- */
.user-search-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.user-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.user-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.user-table tbody tr:hover {
    background: var(--bg);
}

.user-table tbody tr:last-child td {
    border-bottom: none;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ---------- Spinner ---------- */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
