:root {
    --bg: #0f172a;
    --page-bg: #f1f5f9;
    --card: #fff;
    --text: #1e293b;
    --muted: #64748b;
    --accent: #6366f1;
    --accent-dark: #4f46e5;
    --danger: #dc2626;
    --ok: #16a34a;
    --warn: #d97706;
    --border: #e2e8f0;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Login */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: #141414;
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}
.login-box {
    background: var(--card);
    border-radius: 16px;
    padding: 28px 32px 24px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
    text-align: center;
}
.login-logo {
    margin-bottom: 14px;
}
.login-logo-img {
    width: 200px;
    max-width: 78%;
    height: auto;
    display: block;
    margin: 0 auto;
}
.login-title {
    font-size: clamp(1.05rem, 4.5vw, 1.2rem);
    line-height: 1.3;
    font-weight: 700;
    margin: 0 auto 20px;
    max-width: 17em;
    color: var(--text);
}
.login-form { text-align: left; }
.front-page-footer {
    margin-top: 0.85rem;
    text-align: center;
}
.front-page-footer-version,
.front-page-footer-credit {
    margin: 0;
    font-size: 0.62rem;
    line-height: 1.5;
    color: rgba(148, 163, 184, 0.85);
    letter-spacing: 0.02em;
}
.front-page-footer-credit {
    margin-top: 0.2rem;
    font-size: 0.58rem;
}
.front-page-footer-credit a {
    color: inherit;
    text-decoration: none;
}
.front-page-footer-credit a:hover {
    text-decoration: underline;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.form-group input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}
.status-ok {
    color: var(--ok);
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.65rem 1.1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: #f8fafc; }
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: var(--border);
}
.btn-block { width: 100%; margin-top: 0.5rem; }

/* App layout */
.app-layout { background: var(--page-bg); }
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
.app-sidebar {
    background: var(--bg);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
}
.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: inherit;
}
.sidebar-logo { width: 96px; height: auto; }
.sidebar-brand-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 500;
}
.sidebar-link:hover,
.sidebar-link.is-active {
    background: rgba(99, 102, 241, 0.18);
    color: #fff;
}
.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.9;
    background: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
    font-size: 0.85rem;
}
.sidebar-user { font-weight: 600; margin-bottom: 0.5rem; }
.sidebar-footer-links { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.sidebar-footer-link {
    color: #94a3b8;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
}
.sidebar-footer-link:hover,
.sidebar-footer-link.is-active { color: #fff; }
.sidebar-logout-form { display: inline; }

.app-main { min-width: 0; }
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 2.5rem;
}
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.page-header h1 { margin: 0 0 0.25rem; }
.page-header-actions { display: flex; align-items: center; gap: 0.75rem; }
.live-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ok);
    background: #dcfce7;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
}
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}
.panel-title { margin: 0 0 1rem; font-size: 1rem; }

/* Summary */
.summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.summary-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
}
.summary-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 0.35rem;
}
.summary-value { font-size: 1.5rem; line-height: 1.2; }
.summary-ok .summary-value { color: var(--ok); }
.summary-warn .summary-value { color: var(--warn); }
.summary-down .summary-value { color: var(--danger); }

/* Service grid */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.service-grid-compact { gap: 0.75rem; }
.service-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.service-card-static {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}
.service-card-static .service-desc,
.service-card-static .service-group { color: #94a3b8; }
.service-card-static .service-link { color: #a5b4fc; }
.service-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}
.service-card h3 {
    margin: 0;
    font-size: 1rem;
}
.service-group {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    white-space: nowrap;
}
.service-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
    flex: 1;
}
.service-meta { min-height: 1.1rem; }
.service-link {
    font-weight: 600;
    font-size: 0.9rem;
}
.service-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.status-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
}
.service-status-ok { color: var(--ok); }
.service-status-warn { color: var(--warn); }
.service-status-down { color: var(--danger); }
.service-status-pending { color: var(--muted); }

.profile-password-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}
.profile-password-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
}
.profile-password-field input {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}


/* Network management */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.stat-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-ok .stat-value { color: var(--ok); }
.stat-down .stat-value { color: var(--danger); }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.table-wrap { overflow-x: auto; }

.status-pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-up { background: #dcfce7; color: #166534; }
.status-down { background: #fee2e2; color: #991b1b; }
.status-degraded, .status-warn { background: #fef3c7; color: #92400e; }
.status-unknown { background: #f1f5f9; color: var(--muted); }

.badge-vendor { background: #e0e7ff; color: #3730a3; padding: 0.1rem 0.45rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.25rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.tab-nav { display: flex; gap: 0.25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-link {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
}
.tab-link.is-active, .tab-link:hover { background: var(--card); color: var(--accent); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.form-grid label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.form-grid input, .form-grid select, .form-grid textarea {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 0.5rem; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 0.5rem !important; }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-danger { background: var(--danger); color: #fff; border: none; }
.log-accordion {
    background: var(--card);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.log-accordion-summary {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1.1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    user-select: none;
}
.log-accordion-summary:hover { background: #f8fafc; }
.log-accordion-summary::-webkit-details-marker { display: none; }
.log-accordion-summary::marker { content: ''; }
.log-accordion-chevron {
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
    margin-top: -0.15rem;
}
.log-accordion[open] > .log-accordion-summary .log-accordion-chevron {
    transform: rotate(45deg);
    margin-top: 0.1rem;
}
.log-accordion-title { font-size: 1.05rem; color: #0f172a; }
.log-accordion-meta { margin-left: auto; font-weight: 400; text-align: right; }
.log-accordion-body {
    padding: 0 1.1rem 1.1rem;
    border-top: 1px solid var(--border);
}
.log-accordion-body .inline-form { margin-top: 0.85rem; margin-bottom: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; }
.log-accordion-scroll {
    max-height: min(62vh, 520px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}
.log-accordion-scroll.table-wrap { overflow: auto; }
.changelog-intro { margin: 0 0 0.75rem; }
.changelog-log-form { margin: 0; }
.changelog-log-limit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}
.changelog-table .changelog-time {
    white-space: nowrap;
    font-size: 0.82rem;
}
.changelog-table .changelog-build {
    white-space: nowrap;
    text-align: center;
    font-size: 0.88rem;
}
.changelog-table .changelog-summary {
    max-width: 36rem;
    line-height: 1.45;
}
.inline-form { display: inline; }
.inline-actions { margin-bottom: 1rem; }

.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 0.5rem 1rem; }
.detail-grid dt { color: var(--muted); font-weight: 600; }
.detail-grid dd { margin: 0; }

.log-viewer {
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    max-height: 400px;
    overflow: auto;
}
.log-viewer-tall { max-height: 600px; }
.log-line { padding: 0.2rem 0; border-bottom: 1px solid #1e293b; }
.log-error { color: #fca5a5; }
.log-warn { color: #fcd34d; }
.log-meta, .log-time { color: #64748b; margin-right: 0.5rem; }

.code-block, pre.code-block {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow: auto;
    font-size: 0.8rem;
}
.audit-row { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.audit-row code { display: block; margin: 0.35rem 0; word-break: break-all; }

.alert-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.filter-form select { padding: 0.5rem 0.75rem; border-radius: 8px; border: 1px solid var(--border); }

.app-layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; padding: 1.5rem 2rem; min-width: 0; }
.sidebar {
    width: 248px;
    background: var(--bg);
    color: #e2e8f0;
    flex-shrink: 0;
}
.sidebar-inner { padding: 1.5rem 1rem 1.25rem; display: flex; flex-direction: column; min-height: 100vh; }
.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    margin-bottom: 1.5rem;
    text-align: center;
}
.sidebar-brand-logo {
    width: 128px;
    max-width: 92%;
    height: auto;
    display: block;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.62rem 0.8rem;
    border-radius: 8px;
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.9rem;
}
.sidebar-link.is-active,
.sidebar-link:hover {
    background: rgba(99, 102, 241, 0.22);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-group { margin: 0; }
.sidebar-group-summary {
    list-style: none;
    cursor: pointer;
}
.sidebar-group-summary::-webkit-details-marker { display: none; }
.sidebar-group-summary::marker { content: ''; }
.sidebar-group-chevron {
    width: 0.45rem;
    height: 0.45rem;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
    opacity: 0.75;
}
.sidebar-group[open] .sidebar-group-chevron {
    transform: rotate(-135deg);
    margin-top: 0.15rem;
}
.sidebar-submenu {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0.2rem 0 0.35rem;
    padding-left: 0.35rem;
}
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 0.86rem;
    font-weight: 500;
}
.sidebar-sublink .sidebar-icon {
    width: 16px;
    height: 16px;
    opacity: 0.85;
}
.sidebar-sublink.is-active,
.sidebar-sublink:hover {
    background: #1e293b;
    color: #fff;
}
.sidebar-icon-dashboard {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
}
.sidebar-icon-devices {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='4' width='20' height='6' rx='1'/%3E%3Crect x='2' y='14' width='20' height='6' rx='1'/%3E%3Ccircle cx='6' cy='7' r='1' fill='black'/%3E%3Ccircle cx='6' cy='17' r='1' fill='black'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='4' width='20' height='6' rx='1'/%3E%3Crect x='2' y='14' width='20' height='6' rx='1'/%3E%3Ccircle cx='6' cy='7' r='1' fill='black'/%3E%3Ccircle cx='6' cy='17' r='1' fill='black'/%3E%3C/svg%3E");
}
.sidebar-icon-backup {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 3v12m0 0l4-4m-4 4l-4-4M4 15v3a2 2 0 002 2h12a2 2 0 002-2v-3'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 3v12m0 0l4-4m-4 4l-4-4M4 15v3a2 2 0 002 2h12a2 2 0 002-2v-3'/%3E%3C/svg%3E");
}
.sidebar-icon-system {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
}
.sidebar-icon-log {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 4h9l3 3v13H6z'/%3E%3Cpath d='M15 4v3h3M8 12h8M8 16h6'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 4h9l3 3v13H6z'/%3E%3Cpath d='M15 4v3h3M8 12h8M8 16h6'/%3E%3C/svg%3E");
}
.sidebar-icon-profile {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-4 6-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-4 6-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E");
}
.sidebar-icon-users {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='10' r='2.5'/%3E%3Cpath d='M3 20c0-3.5 2.5-6 6-6s6 2.5 6 6M14 20c0-2.5 1.5-4.5 4-4.5'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='10' r='2.5'/%3E%3Cpath d='M3 20c0-3.5 2.5-6 6-6s6 2.5 6 6M14 20c0-2.5 1.5-4.5 4-4.5'/%3E%3C/svg%3E");
}
.badge-role {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #334155;
}
.badge-role-admin {
    background: #dbeafe;
    color: #1d4ed8;
}
.profile-info-grid { margin-top: 0.5rem; }
.profile-password-grid { max-width: 520px; }

/* Profile page */
.profile-main {
    max-width: 1080px;
    margin: 0 auto;
    padding-top: 1.25rem;
}
.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}
.profile-stat-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.profile-stat-card:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
    border-color: #cbd5e1;
}
.profile-stat-card-live {
    border-color: #c7d2fe;
    background: linear-gradient(180deg, #fff 0%, #f5f7ff 100%);
}
.profile-stat-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    flex-shrink: 0;
    background: #eef2ff;
    color: var(--accent);
    mask-size: 55%;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: 55%;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    background-color: #e0e7ff;
}
.profile-stat-icon-time {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}
.profile-stat-icon-ip-prev {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M7 9h4M7 13h10'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M7 9h4M7 13h10'/%3E%3C/svg%3E");
}
.profile-stat-icon-ip-now {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41'/%3E%3C/svg%3E");
}
.profile-stat-icon-history {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 6h16M4 12h10M4 18h14'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 6h16M4 12h10M4 18h14'/%3E%3C/svg%3E");
}
.profile-stat-icon-users {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='10' r='2.5'/%3E%3Cpath d='M3 20c0-3.5 2.5-6 6-6s6 2.5 6 6M14 20c0-2.5 1.5-4.5 4-4.5'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='10' r='2.5'/%3E%3Cpath d='M3 20c0-3.5 2.5-6 6-6s6 2.5 6 6M14 20c0-2.5 1.5-4.5 4-4.5'/%3E%3C/svg%3E");
}
.profile-stat-icon-admin {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 3l8 4v6c0 5-3.5 8.5-8 9-4.5-.5-8-4-8-9V7l8-4z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 3l8 4v6c0 5-3.5 8.5-8 9-4.5-.5-8-4-8-9V7l8-4z'/%3E%3C/svg%3E");
}
.profile-stat-body { min-width: 0; }
.profile-stat-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 0.2rem;
}
.profile-stat-value {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    word-break: break-word;
}
.profile-stat-mono {
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: 0.88rem;
}
.profile-live-dot {
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
    animation: profile-pulse 2s ease-in-out infinite;
}
@keyframes profile-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.profile-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.profile-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem 1.35rem 1.35rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.profile-panel-accent {
    background: linear-gradient(165deg, #f8fafc 0%, #fff 55%);
    border-color: #e2e8f0;
}
.profile-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.15rem;
}
.profile-panel-head h2 {
    margin: 0 0 0.15rem;
    font-size: 1.05rem;
}
.profile-panel-head p { margin: 0; font-size: 0.85rem; }
.profile-panel-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    flex-shrink: 0;
    background: #eef2ff;
    mask-size: 52%;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: 52%;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    background-color: #e0e7ff;
}
.profile-panel-icon-lock {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 118 0v3'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 118 0v3'/%3E%3C/svg%3E");
}
.profile-panel-icon-shield {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 3l8 4v6c0 5-3.5 8.5-8 9-4.5-.5-8-4-8-9V7l8-4z'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 3l8 4v6c0 5-3.5 8.5-8 9-4.5-.5-8-4-8-9V7l8-4z'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E");
}
.profile-panel-icon-clock {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}
.profile-panel-icon-users {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='10' r='2.5'/%3E%3Cpath d='M3 20c0-3.5 2.5-6 6-6s6 2.5 6 6M14 20c0-2.5 1.5-4.5 4-4.5'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='10' r='2.5'/%3E%3Cpath d='M3 20c0-3.5 2.5-6 6-6s6 2.5 6 6M14 20c0-2.5 1.5-4.5 4-4.5'/%3E%3C/svg%3E");
}
.profile-panel-icon-add {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-4 6-6 8-6s6.5 2 8 6M19 8v6M16 11h6'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-4 6-6 8-6s6.5 2 8 6M19 8v6M16 11h6'/%3E%3C/svg%3E");
}

.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.profile-form-grid .profile-form-actions { grid-column: 1 / -1; }
.profile-field select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #f8fafc;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.profile-field select:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.profile-field input[type="text"] {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #f8fafc;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.profile-field input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Modals */
body.modal-open,
body.notify-modal-open { overflow: hidden; }
.notify-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.notify-modal.is-open {
    opacity: 1;
    visibility: visible;
}
.notify-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(3px);
}
.notify-modal-dialog {
    position: relative;
    width: min(100%, 22rem);
    background: var(--card);
    border-radius: 16px;
    padding: 1.65rem 1.5rem 1.35rem;
    text-align: center;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
    border: 1px solid var(--border);
    transform: translateY(12px) scale(0.97);
    transition: transform 0.22s ease;
}
.notify-modal.is-open .notify-modal-dialog {
    transform: translateY(0) scale(1);
}
.notify-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
}
.notify-modal-ok .notify-modal-icon {
    background: #dcfce7;
    color: var(--ok);
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.12);
}
.notify-modal-error .notify-modal-icon {
    background: #fee2e2;
    color: var(--danger);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.1);
}
.notify-modal-title {
    margin: 0 0 0.45rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.notify-modal-message {
    margin: 0 0 1.25rem;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--muted);
}
.notify-modal-close {
    min-width: 7.5rem;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 190;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.app-modal.is-open {
    opacity: 1;
    visibility: visible;
}
.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(3px);
}
.app-modal-dialog {
    position: relative;
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
    transform: translateY(12px) scale(0.97);
    transition: transform 0.22s ease;
}
.app-modal.is-open .app-modal-dialog {
    transform: translateY(0) scale(1);
}
.app-modal-dialog-form {
    width: min(100%, 32rem);
    padding: 1.35rem 1.35rem 1.25rem;
    text-align: left;
}
.app-modal-form-head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.1rem;
}
.app-modal-form-head-text { flex: 1; min-width: 0; }
.app-modal-form-head-text h2 {
    margin: 0 0 0.15rem;
    font-size: 1.1rem;
}
.app-modal-form-head-text p { margin: 0; font-size: 0.85rem; }
.app-modal-dismiss {
    border: none;
    background: #f1f5f9;
    color: var(--muted);
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.app-modal-dismiss:hover {
    background: #e2e8f0;
    color: var(--text);
}
.app-modal-inline-alert {
    margin-bottom: 1rem;
}
.app-modal-form .profile-form-grid {
    grid-template-columns: 1fr;
}

.profile-password-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.profile-field { display: flex; flex-direction: column; gap: 0.4rem; }
.profile-field-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.profile-input-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}
.profile-input-wrap input {
    width: 100%;
    padding: 0.7rem 2.75rem 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #f8fafc;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.profile-input-wrap input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.profile-pw-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}
.profile-pw-toggle:hover { background: #e2e8f0; color: var(--text); }
.profile-pw-toggle-icon {
    width: 1.1rem;
    height: 1.1rem;
    background: currentColor;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    mask-size: contain;
    -webkit-mask-size: contain;
}
.profile-pw-toggle.is-visible .profile-pw-toggle-icon {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 3l18 18M10.5 10.7A3 3 0 0012 15a3 3 0 002.3-1.5M7.2 7.2C5.6 8.4 4.2 10 3 12c0 0 3.5 7 9 7 1.6 0 3-.4 4.2-1M14 6.5A3 3 0 0012 5c-4.2 0-7.8 3.5-9 7 0 0 1.2 2.4 3 4'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 3l18 18M10.5 10.7A3 3 0 0012 15a3 3 0 002.3-1.5M7.2 7.2C5.6 8.4 4.2 10 3 12c0 0 3.5 7 9 7 1.6 0 3-.4 4.2-1M14 6.5A3 3 0 0012 5c-4.2 0-7.8 3.5-9 7 0 0 1.2 2.4 3 4'/%3E%3C/svg%3E");
}
.profile-form-actions {
    margin-top: 0.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.profile-session-list {
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.profile-session-row {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.5rem;
    align-items: center;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
}
.profile-session-row:last-child { border-bottom: none; padding-bottom: 0; }
.profile-session-row dt {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
}
.profile-session-row dd { margin: 0; font-size: 0.9rem; font-weight: 500; }
.profile-session-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #166534;
    background: #dcfce7;
}
.profile-session-badge::before {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: var(--ok);
}
.profile-ip-chip {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.82rem;
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: #334155;
}
.profile-security-note {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 0.75rem 0.85rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    color: #92400e !important;
}

.profile-panel-history { margin-bottom: 0.5rem; }
.profile-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}
.profile-empty-icon {
    display: block;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 0.75rem;
    opacity: 0.45;
    background: var(--muted);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
    mask-size: contain;
    -webkit-mask-size: contain;
}
.profile-empty p { margin: 0; font-size: 0.9rem; }

.profile-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.profile-timeline-item {
    display: grid;
    grid-template-columns: 1.35rem 1fr;
    gap: 0.85rem;
    position: relative;
    padding-bottom: 0.85rem;
}
.profile-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 0.55rem;
    top: 1.35rem;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #c7d2fe 0%, #e2e8f0 100%);
}
.profile-timeline-marker {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    margin-top: 0.55rem;
    background: #fff;
    border: 2px solid #c7d2fe;
    box-shadow: 0 0 0 3px #fff;
    z-index: 1;
}
.profile-timeline-item.is-latest .profile-timeline-marker {
    border-color: var(--accent);
    background: #eef2ff;
}
.profile-timeline-item.is-current .profile-timeline-marker {
    border-color: var(--ok);
    background: #dcfce7;
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(22, 163, 74, 0.15);
}
.profile-timeline-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.profile-timeline-item.is-current .profile-timeline-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
    border-color: #86efac;
}
.profile-timeline-item:hover .profile-timeline-card {
    border-color: #cbd5e1;
    background: #fff;
}
.profile-timeline-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}
.profile-timeline-time {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}
.profile-timeline-tag {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
}
.profile-timeline-tag-current {
    background: #dcfce7;
    color: #166534;
}
.profile-timeline-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}
.profile-timeline-ua {
    font-size: 0.78rem;
    color: var(--muted);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .profile-stats { grid-template-columns: 1fr; }
    .profile-session-row { grid-template-columns: 1fr; gap: 0.15rem; }
}
.user-actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.inline-user-password-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.inline-user-password-form input[type="password"] {
    min-width: 140px;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}
.sidebar-icon-logout {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
}
.sidebar-logout-form {
    margin: 0.35rem 0 0;
    padding-top: 0.35rem;
    border-top: 1px solid #334155;
}
.sidebar-logout-btn {
    width: 100%;
    border: none;
    background: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.sidebar-logout-btn:hover {
    background: rgba(99, 102, 241, 0.22);
    color: #fff;
}
.sidebar-toggle { display: none; }

@media (max-width: 900px) {
    .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform 0.2s; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        z-index: 60;
        background: var(--bg);
        color: #fff;
        border: none;
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
    }
    .main-content { padding: 3rem 1rem 1.5rem; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem;
    }
    .sidebar-brand { flex-direction: row; margin-bottom: 0; gap: 0.75rem; }
    .sidebar-brand-logo { width: 64px; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-footer { width: 100%; }
    .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}