/* ============================================================
   Tracker — Neomorphism + Glass UI
   Light / Dark themes, fully responsive
   ============================================================ */

:root {
    --bg: #e8edf6;
    --bg-2: #f3f6fc;
    --sidebar: rgba(255, 255, 255, 0.55);
    --card: rgba(255, 255, 255, 0.58);
    --card-solid: #eef2f9;
    --border: rgba(255, 255, 255, 0.72);
    --border-strong: rgba(148, 163, 184, 0.28);
    --text: #1b2433;
    --muted: #6b7688;
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-soft: rgba(99, 102, 241, 0.14);
    --green: #10b981;
    --red: #ef4444;
    --yellow: #f59e0b;
    --hover: rgba(99, 102, 241, 0.08);
    --input-bg: rgba(255, 255, 255, 0.5);
    --shadow: rgba(163, 177, 198, 0.5);
    --shadow-dark: rgba(163, 177, 198, 0.55);
    --shadow-light: rgba(255, 255, 255, 0.95);
    --shadow-raised: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
    --shadow-soft: 5px 5px 14px var(--shadow-dark), -5px -5px 14px var(--shadow-light);
    --shadow-inset: inset 3px 3px 8px var(--shadow-dark), inset -3px -3px 8px var(--shadow-light);
    --glass-blur: 18px;
    --radius: 22px;
    --radius-sm: 14px;
    --ring: 0 0 0 4px var(--accent-soft);
    --sidebar-w: 272px;
}

html.dark-theme {
    --bg: #12151c;
    --bg-2: #171b24;
    --sidebar: rgba(30, 36, 48, 0.62);
    --card: rgba(30, 36, 48, 0.62);
    --card-solid: #1b202b;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #e8ecf4;
    --muted: #9aa6b8;
    --accent: #818cf8;
    --accent-2: #a78bfa;
    --accent-soft: rgba(129, 140, 248, 0.16);
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;
    --hover: rgba(255, 255, 255, 0.06);
    --input-bg: rgba(255, 255, 255, 0.05);
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-dark: rgba(0, 0, 0, 0.55);
    --shadow-light: rgba(255, 255, 255, 0.04);
    --shadow-raised: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
    --shadow-soft: 5px 5px 14px var(--shadow-dark), -5px -5px 14px var(--shadow-light);
    --shadow-inset: inset 3px 3px 8px var(--shadow-dark), inset -3px -3px 8px var(--shadow-light);
}

* {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 800px at 8% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
        radial-gradient(1000px 700px at 108% 8%, rgba(139, 92, 246, 0.16), transparent 55%),
        radial-gradient(900px 700px at 50% 120%, rgba(16, 185, 129, 0.10), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-size: 15px;
    line-height: 1.45;
    transition: background 0.35s ease, color 0.35s ease;
    -webkit-font-smoothing: antialiased;
}

html.dark-theme body {
    background:
        radial-gradient(1200px 800px at 8% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
        radial-gradient(1000px 700px at 108% 8%, rgba(139, 92, 246, 0.14), transparent 55%),
        radial-gradient(900px 700px at 50% 120%, rgba(16, 185, 129, 0.08), transparent 60%),
        var(--bg);
}

h1, h2, h3, h4 { color: var(--text); letter-spacing: -0.02em; }
h2 { font-size: 1.6rem; margin: 0 0 20px; font-weight: 800; }
a { color: var(--accent); }

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ============================ SIDEBAR ============================ */

.sidebar {
    position: fixed;
    top: 16px;
    left: 16px;
    width: var(--sidebar-w);
    height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: var(--sidebar);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow-raised);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    z-index: 50;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), background 0.35s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px 18px;
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: -0.6px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border-strong);
    margin-bottom: 10px;
}

.logo svg {
    width: 30px;
    height: 30px;
    fill: var(--accent);
    filter: drop-shadow(0 6px 12px rgba(99, 102, 241, 0.35));
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin: 3px 4px;
    border-radius: 14px;
    color: var(--muted);
    font-weight: 650;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-item svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }

.nav-item:hover {
    background: var(--hover);
    color: var(--text);
    transform: translateX(2px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 10px 22px rgba(99, 102, 241, 0.35);
}

.nav-item.active svg { fill: #fff; }

.user-profile {
    margin-top: auto;
    padding: 14px 8px 6px;
    border-top: 1px solid var(--border-strong);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-info-row { display: flex; align-items: center; gap: 12px; }

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    text-transform: uppercase;
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.35);
    flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-details b { font-size: 14px; color: var(--text); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details span { font-size: 12px; color: var(--muted); }

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.10);
    color: var(--red);
    padding: 10px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid rgba(239, 68, 68, 0.18);
    transition: 0.2s ease;
}

.logout-btn:hover { background: var(--red); color: #fff; box-shadow: 0 8px 18px rgba(239, 68, 68, 0.3); }

.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--input-bg);
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-inset);
}

.theme-toggle-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.theme-switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.theme-switch input { opacity: 0; width: 0; height: 0; padding: 0; border: 0; box-shadow: none; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-inset);
    transition: 0.35s ease;
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(135deg, #fff, #e2e8f0);
    transition: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.theme-switch input:checked + .slider { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.theme-switch input:checked + .slider:before { transform: translateX(22px); }
.slider-icon { line-height: 1; z-index: 1; display: flex; align-items: center; justify-content: center; }
.slider-icon svg { width: 12px; height: 12px; display: block; fill: currentColor; }
.slider-icon.sun { color: #f59e0b; margin-left: 2px; }
.slider-icon.moon { color: #fff; margin-right: 2px; }

/* Иконки переключателя темы: луна в светлой теме, солнце в тёмной */
.topbar-theme .ic-sun, .login-theme .ic-sun { display: none; }
.topbar-theme svg, .login-theme svg { width: 20px; height: 20px; fill: currentColor; }
html.dark-theme .topbar-theme .ic-sun, html.dark-theme .login-theme .ic-sun { display: block; }
html.dark-theme .topbar-theme .ic-moon, html.dark-theme .login-theme .ic-moon { display: none; }

/* ============================ TOPBAR (mobile) ============================ */

.topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    background: var(--sidebar);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    z-index: 60;
}

.topbar .logo {
    border: none;
    padding: 0;
    margin: 0;
    font-size: 1.2rem;
    flex: 1;
    min-width: 0;
}

.topbar .logo svg { width: 24px; height: 24px; }

.hamburger,
.topbar-theme {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-soft);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
}

.hamburger:active,
.topbar-theme:active { box-shadow: var(--shadow-inset); transform: none; }

.hamburger svg { width: 22px; height: 22px; fill: currentColor; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 20, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 45;
}

.sidebar-overlay.active { display: block; }

/* ============================ MAIN ============================ */

.main {
    margin-left: calc(var(--sidebar-w) + 32px);
    padding: 28px 32px 48px;
    min-height: 100vh;
    /* без fill-mode: анимация не должна оставлять на .main stacking context,
       иначе .modal-overlay (z-index 1000) не перекрывает .sidebar (z-index 50) */
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================ CARDS ============================ */

.card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    transition: background 0.35s ease, box-shadow 0.25s ease, border-color 0.35s ease;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 16px;
    color: var(--text);
}

.card-title svg { width: 20px; height: 20px; fill: var(--muted); flex-shrink: 0; }

/* ============================ FORMS ============================ */

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 130px; }
.form-group label { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: 0.01em; }

input, select, textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    box-shadow: var(--shadow-inset);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.35s ease;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

select option { background: var(--card-solid); color: var(--text); }

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-inset), var(--ring);
    background: var(--card);
}

input[type="checkbox"]:not(.theme-input),
input[type="radio"]:not(.theme-input) {
    width: 20px;
    height: 20px;
    min-width: 20px;
    padding: 0;
    border-radius: 6px;
    border: 1.5px solid var(--border-strong);
    background: var(--input-bg);
    box-shadow: var(--shadow-inset);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="checkbox"]:not(.theme-input):hover,
input[type="radio"]:not(.theme-input):hover { border-color: var(--accent); }

input[type="checkbox"]:not(.theme-input):checked {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 13px no-repeat,
        linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35);
}

input[type="radio"]:not(.theme-input) { border-radius: 50%; }

input[type="radio"]:not(.theme-input):checked {
    background:
        radial-gradient(circle at center, #fff 0 4px, transparent 4.5px),
        linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
}

input[type="file"] { padding: 9px 12px; cursor: pointer; }
input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 12px;
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

textarea { min-height: 96px; resize: vertical; }

/* ============================ BUTTONS ============================ */

button, .btn, .btn-green, .btn-red, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    outline: none;
    text-decoration: none;
    box-shadow: 4px 4px 12px var(--shadow-dark), -4px -4px 12px var(--shadow-light);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

button:hover, .btn:hover, .btn-green:hover, .btn-red:hover, .btn-ghost:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 6px 6px 16px var(--shadow-dark), -6px -6px 16px var(--shadow-light);
}

button:active, .btn:active, .btn-green:active, .btn-red:active, .btn-ghost:active {
    transform: translateY(0);
    box-shadow: var(--shadow-inset);
    filter: none;
}

.btn-green { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-red { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }

.btn-ghost {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-soft);
}

.btn-ghost:hover { background: var(--hover); filter: none; }

.btn-sm {
    padding: 7px 12px;
    font-size: 12.5px;
    border-radius: 10px;
    box-shadow: 2px 2px 6px var(--shadow-dark), -2px -2px 6px var(--shadow-light);
}

.btn-sm:hover { box-shadow: 3px 3px 9px var(--shadow-dark), -3px -3px 9px var(--shadow-light); }

/* ============================ MESSAGES ============================ */

.msg {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 22px;
    border-radius: 16px;
    background: var(--accent-soft);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--accent);
    font-weight: 700;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.msg-close { cursor: pointer; opacity: 0.7; transition: opacity 0.2s; }
.msg-close:hover { opacity: 1; }

/* ============================ TABLES ============================ */

.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
    border-radius: 16px;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    white-space: nowrap;
}

th, td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
}

th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--input-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--muted);
    font-weight: 800;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

th:first-child { border-top-left-radius: 14px; }
th:last-child { border-top-right-radius: 14px; }

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--hover); }

/* ============================ BADGES ============================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid transparent;
    line-height: 1.4;
}

.badge-blue { background: rgba(99, 102, 241, 0.14); color: var(--accent); border-color: rgba(99, 102, 241, 0.22); }
.badge-green { background: rgba(16, 185, 129, 0.14); color: var(--green); border-color: rgba(16, 185, 129, 0.22); }
.badge-yellow { background: rgba(245, 158, 11, 0.14); color: var(--yellow); border-color: rgba(245, 158, 11, 0.22); }
.badge-purple { background: rgba(139, 92, 246, 0.14); color: var(--accent-2); border-color: rgba(139, 92, 246, 0.22); }
.badge-red { background: rgba(239, 68, 68, 0.14); color: var(--red); border-color: rgba(239, 68, 68, 0.22); }

/* ============================ MODALS ============================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 12, 20, 0.68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
}

.modal-overlay.active { display: flex; }

.modal-content {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    background:
        linear-gradient(var(--card-solid), var(--card-solid)) padding-box,
        linear-gradient(135deg, rgba(99, 102, 241, 0.55), rgba(139, 92, 246, 0.55)) border-box;
    border: 1px solid transparent;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    animation: modalIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal-content .btn-sm {
    padding: 11px 18px;
    font-size: 14px;
    border-radius: 12px;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-strong);
}

.modal-header h3 { margin: 0; font-size: 1.15rem; font-weight: 800; }

.modal-close {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    transition: 0.2s ease;
}

.modal-close:hover { color: var(--red); background: rgba(239, 68, 68, 0.1) !important; transform: none; }

/* ============================ SUB NAV ============================ */

.sub-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    padding: 6px;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    box-shadow: var(--shadow-inset);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sub-nav-item {
    padding: 9px 16px;
    border-radius: 11px;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    transition: 0.2s ease;
}

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

.sub-nav-item.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.3);
}

/* ============================ LINK ITEMS ============================ */

.link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.link-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-raised); }

.link-url { color: var(--accent); font-weight: 700; word-break: break-all; text-decoration: none; }
.link-url:hover { text-decoration: underline; }
.link-info { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ============================ ALERTS / PREVIEW ============================ */

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 16px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.28);
    color: var(--yellow);
    font-weight: 700;
    box-shadow: var(--shadow-soft);
}

.alert a {
    background: var(--yellow);
    color: #1b2433;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    transition: 0.2s ease;
}

.alert a:hover { filter: brightness(1.08); }

.user-info {
    margin-top: auto;
    padding: 16px 8px 6px;
    border-top: 1px solid var(--border-strong);
    font-size: 13px;
    color: var(--muted);
}

.user-info b { display: block; color: var(--accent); font-size: 14px; margin-bottom: 2px; }
.user-info a { color: var(--red); text-decoration: none; font-weight: 700; display: inline-block; margin-top: 8px; }

/* ============================ LOGIN ============================ */

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 38px 32px 32px;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 30px;
    box-shadow: var(--shadow-raised);
    backdrop-filter: blur(26px) saturate(150%);
    -webkit-backdrop-filter: blur(26px) saturate(150%);
    animation: modalIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.logo-wrap svg {
    width: 44px;
    height: 44px;
    fill: var(--accent);
    filter: drop-shadow(0 8px 16px rgba(99, 102, 241, 0.4));
}

.logo-wrap h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-box input { margin-bottom: 12px; }
.login-box button[type="submit"] { width: 100%; margin-top: 4px; padding: 13px; font-size: 15px; }

.captcha {
    padding: 12px;
    margin-bottom: 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: var(--shadow-inset);
    font-weight: 800;
    letter-spacing: 3px;
    font-size: 18px;
    color: var(--text);
    user-select: none;
}

.err {
    padding: 10px 12px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--red);
    font-size: 13px;
    font-weight: 700;
}

.login-theme {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* ============================ RESPONSIVE ============================ */

@media (max-width: 1200px) {
    .dashboard { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 1024px) {
    .topbar { display: flex; }

    .sidebar {
        top: 76px;
        left: 12px;
        width: 280px;
        height: calc(100vh - 88px);
        transform: translateX(-120%);
        z-index: 70;
    }

    .sidebar.open { transform: translateX(0); }

    .main {
        margin-left: 0;
        padding: 84px 18px 36px;
    }
}

@media (max-width: 768px) {
    body { font-size: 14.5px; }
    h2 { font-size: 1.35rem; margin-bottom: 16px; }

    .main { padding: 80px 14px 32px; }

    .card { padding: 18px; border-radius: 18px; margin-bottom: 16px; }
    .card-title { font-size: 1rem; }

    .form-row { gap: 10px; }
    .form-group { min-width: 100%; }

    .dashboard { grid-template-columns: 1fr !important; gap: 12px !important; }

    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal-content { max-width: 100%; max-height: 92vh; border-radius: 22px; padding: 18px; }

    .sub-nav { border-radius: 14px; }
    .sub-nav-item { padding: 8px 13px; font-size: 13px; }

    .link-item { flex-direction: column; align-items: stretch; }
    .link-item form { width: 100%; }
    .link-item form button { width: 100%; }

    .table-wrap { margin-left: -2px; margin-right: -2px; }
    th, td { padding: 9px 10px; }

    .msg { padding: 12px 14px; font-size: 13.5px; }
}

@media (max-width: 480px) {
    .main { padding: 76px 10px 28px; }
    .card { padding: 15px; border-radius: 16px; }
    .login-box { padding: 30px 20px 24px; border-radius: 24px; }
    .logo-wrap h2 { font-size: 1.7rem; }
    .logo-wrap svg { width: 38px; height: 38px; }
    .dash-main-val { font-size: 26px !important; }
    .topbar { height: 60px; padding: 0 10px; }
    .hamburger, .topbar-theme { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
