@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;700;800&display=swap');

:root {
    --admin-bg: #f1f5f9;
    --admin-panel: #ffffff;
    --admin-text: #0f172a;
    --admin-muted: #64748b;
    --admin-line: #e2e8f0;
    --admin-brand: #4f46e5;
    --admin-brand-strong: #4338ca;
    --admin-brand-soft: #e0e7ff;
    --admin-sidebar: #0f172a;
    --admin-sidebar-soft: #1e293b;
    --admin-danger: #ef4444;
    --admin-success: #10b981;
    --admin-warning: #f59e0b;
    --admin-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.12);
    --admin-shadow-soft: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--admin-bg);
    color: var(--admin-text);
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6, .admin-brand-mark {
    font-family: 'Outfit', sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.admin-login-body {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 28px;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.10), transparent 40%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.08), transparent 40%),
        #f1f5f9;
}

.login-card,
.admin-panel,
.admin-card {
    background: var(--admin-panel);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    box-shadow: var(--admin-shadow-soft);
}

.login-shell {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 20px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(380px, 1fr);
    max-width: 980px;
    min-height: 590px;
    overflow: hidden;
    width: 100%;
}

.login-hero {
    background:
        radial-gradient(circle at top, rgba(79, 70, 229, 0.6) 0%, transparent 70%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 1));
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 42px;
}

.login-brand-mark,
.admin-brand-mark {
    align-items: center;
    background: linear-gradient(135deg, var(--admin-brand), #3b82f6);
    border-radius: 12px;
    color: #ffffff;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
}

.login-brand-mark {
    box-shadow: 0 14px 34px rgba(20, 184, 166, 0.28);
    height: 54px;
    margin-bottom: auto;
    width: 54px;
}

.login-eyebrow,
.login-card-top span {
    color: #818cf8;
    display: block;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.login-hero h1 {
    font-size: clamp(32px, 4vw, 50px);
    line-height: 1;
    margin: 0 0 16px;
}

.login-hero p {
    color: rgba(255, 255, 255, 0.78);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    max-width: 420px;
}

.login-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
}

.login-feature-list span {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 800;
    padding: 8px 10px;
}

.login-card {
    align-self: center;
    border: 0;
    box-shadow: none;
    justify-self: center;
    max-width: 430px;
    padding: 34px;
    width: 100%;
}

.login-card-top {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.login-card-top h1,
.login-card-top h2 {
    font-size: 28px;
    line-height: 1.1;
    margin: 0;
}

.login-security-note {
    color: var(--admin-muted);
    font-size: 13px;
    line-height: 1.5;
    margin: 18px 0 0;
}

.install-card {
    max-width: 460px;
}

.install-card-wide {
    max-width: 980px;
}

.install-intro {
    color: var(--admin-muted);
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.install-intro p {
    margin: 0;
}

.install-intro strong {
    color: var(--admin-text);
}

.install-status-grid {
    margin-bottom: 18px;
}

.install-note {
    color: var(--admin-muted);
    font-size: 13px;
    margin: -6px 0 18px;
}

.admin-body {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    background: linear-gradient(180deg, var(--admin-sidebar) 0%, #1e293b 100%);
    color: #ffffff;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-mobile-topbar,
.admin-mobile-menu-button,
.admin-menu-backdrop {
    display: none;
}

.admin-mobile-menu-button {
    align-items: center;
    background: var(--admin-brand-soft);
    border: 0;
    border-radius: 12px;
    box-shadow: none;
    cursor: pointer;
    height: 44px;
    justify-content: center;
    padding: 0;
    position: relative;
    width: 44px;
    transition: background 0.2s ease;
}

.admin-mobile-menu-button:hover {
    background: #c7d2fe;
}

.admin-mobile-menu-button span {
    background: var(--admin-brand);
    border-radius: 999px;
    display: block;
    height: 2px;
    left: 12px;
    position: absolute;
    transition: transform 0.2s ease, opacity 0.2s ease;
    width: 20px;
}

.admin-mobile-menu-button span:nth-child(1) {
    top: 13px;
}

.admin-mobile-menu-button span:nth-child(2) {
    top: 19px;
}

.admin-mobile-menu-button span:nth-child(3) {
    top: 25px;
}

.admin-menu-open .admin-mobile-menu-button span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.admin-menu-open .admin-mobile-menu-button span:nth-child(2) {
    opacity: 0;
}

.admin-menu-open .admin-mobile-menu-button span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.admin-mobile-menu-button:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.28);
    outline-offset: 2px;
}

.admin-brand-block {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    display: flex;
    gap: 12px;
    margin: 0 6px 18px;
    padding-bottom: 18px;
}

.admin-brand-mark {
    flex: 0 0 auto;
    height: 42px;
    width: 42px;
}

.admin-brand-block strong {
    display: block;
    font-size: 17px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.admin-brand-block span {
    color: #9fb0c2;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-sidebar nav {
    display: grid;
    gap: 15px;
}

.admin-nav-group {
    display: grid;
    gap: 3px;
}

.admin-nav-group-title {
    color: #8fa1b8;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.06em;
    padding: 0 12px 5px;
    text-transform: uppercase;
}

.admin-sidebar a {
    align-items: center;
    border-radius: 10px;
    color: #cbd5e1;
    display: flex;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    min-height: 44px;
    padding: 10px 14px;
    position: relative;
    transition: background 0.2s ease, color 0.2s ease;
}

.admin-nav-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 7px;
    color: #a7f3d0;
    display: inline-flex;
    flex: 0 0 30px;
    height: 30px;
    justify-content: center;
    width: 30px;
}

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

.admin-sidebar a span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.admin-sidebar a.active .admin-nav-icon,
.admin-sidebar a:hover .admin-nav-icon {
    background: linear-gradient(135deg, var(--admin-brand), #3b82f6);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.admin-sidebar a.active::before {
    background: #3b82f6;
    border-radius: 999px;
    content: "";
    height: 24px;
    left: -8px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
}

.admin-main {
    min-width: 0;
    padding: 26px;
}

.admin-header {
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    box-shadow: var(--admin-shadow-soft);
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 24px;
}

.admin-header p {
    color: var(--admin-muted);
    margin: 0 0 4px;
}

.admin-header-kicker {
    color: var(--admin-brand) !important;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-header h1 {
    font-size: clamp(26px, 3vw, 34px);
    letter-spacing: 0;
    line-height: 1.1;
    margin: 0;
}

.admin-header-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.admin-language-selector label {
    align-items: center;
    color: var(--admin-muted);
    display: flex;
    font-size: 12px;
    font-weight: 800;
    gap: 8px;
}

.admin-language-selector select {
    background: #ffffff;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    color: var(--admin-text);
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
}

.license-pill {
    border-radius: 8px;
    font-weight: 800;
    padding: 9px 12px;
}

.license-pill.valid {
    background: #e6f5ec;
    color: var(--admin-success);
}

.license-pill.invalid {
    background: #fff1d6;
    color: var(--admin-warning);
}

.admin-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 20px;
}

.dashboard-hero {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.dashboard-hero h2 {
    margin: 0 0 6px;
}

.dashboard-hero p {
    color: var(--admin-muted);
    margin: 0;
}

.install-tracking-panel {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.support-panel {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.support-panel p {
    color: var(--admin-muted);
    margin: 6px 0 0;
}

.install-tracking-panel p {
    color: var(--admin-muted);
    margin: 6px 0 0;
}

.admin-button {
    background: var(--admin-brand);
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    justify-content: center;
    min-height: 44px;
    padding: 12px 18px;
    transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.admin-button:hover,
.admin-form button:hover,
.login-card button:hover {
    background: var(--admin-brand-strong);
}

.admin-button:active,
.admin-form button:active,
.login-card button:active {
    transform: translateY(1px);
}

.admin-card,
.admin-panel {
    border-radius: 10px;
    padding: 20px;
}

.admin-panel {
    margin-bottom: 18px;
}

.admin-card span {
    color: var(--admin-muted);
    display: block;
    font-size: 13px;
    margin-bottom: 10px;
}

.admin-card strong {
    display: block;
    font-size: 26px;
    overflow-wrap: anywhere;
}

.admin-card-value-small {
    font-size: 16px !important;
}

.admin-card small {
    color: var(--admin-muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-top: 8px;
}

.admin-alert {
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.admin-alert.success {
    background: #e6f5ec;
    color: var(--admin-success);
}

.admin-alert.error {
    background: #fff3f0;
    color: var(--admin-danger);
}

.admin-alert.warning {
    background: #fff7e6;
    color: var(--admin-warning);
}

.admin-demo-mode [data-admin-form] input:not([type="hidden"]),
.admin-demo-mode [data-admin-form] select,
.admin-demo-mode [data-admin-form] textarea {
    background: #f7f9fb;
    cursor: not-allowed;
    opacity: 0.76;
}

.admin-demo-mode [data-admin-form] button {
    cursor: not-allowed;
    opacity: 0.55;
}

.admin-form {
    display: grid;
    gap: 16px;
}

.admin-form h2 {
    margin: 8px 0 0;
}

.admin-form h3 {
    margin: 0;
}

.admin-help-text {
    color: var(--admin-muted);
    margin: -6px 0 0;
}

.admin-subpanel {
    background: #fbfdff;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    padding: 16px;
}

.admin-check-row {
    align-items: center;
    display: flex !important;
    gap: 10px !important;
}

.admin-form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.admin-form label,
.login-card label,
.install-card label {
    color: var(--admin-text);
    display: grid;
    font-size: 14px;
    font-weight: 600;
    gap: 8px;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.login-card input {
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    color: var(--admin-text);
    font-family: inherit;
    font-size: 15px;
    min-height: 44px;
    padding: 10px 14px;
    width: 100%;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus,
.login-card input:focus,
.admin-language-selector select:focus {
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
    outline: 0;
}

.admin-form .admin-check-row input[type="checkbox"] {
    flex: 0 0 auto;
    height: 18px;
    min-height: 18px;
    padding: 0;
    width: 18px;
}

.admin-form textarea {
    resize: vertical;
}

.admin-form button,
.login-card button {
    background: var(--admin-brand);
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    min-height: 46px;
    padding: 0 20px;
    width: fit-content;
    transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.admin-form button:disabled,
.login-card button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.admin-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    border-collapse: collapse;
    min-width: 720px;
    width: 100%;
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--admin-line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.admin-table th {
    color: var(--admin-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.system-status-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    margin-top: 14px;
}

.system-status-item {
    align-items: center;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-width: 0;
    padding: 14px;
}

.system-status-item strong,
.system-status-item span {
    display: block;
    overflow-wrap: anywhere;
}

.system-status-item span {
    color: var(--admin-muted);
    font-size: 13px;
    margin-top: 4px;
}

.system-status-item em {
    border-radius: 8px;
    flex: 0 0 auto;
    font-style: normal;
    font-weight: 800;
    padding: 7px 10px;
}

.status-ok {
    background: #e6f5ec;
    color: var(--admin-success);
}

.status-alert {
    background: #fff3f0;
    color: var(--admin-danger);
}

.login-card form {
    display: grid;
    gap: 14px;
}

.menu-editor {
    display: grid;
    gap: 10px;
}

.menu-row {
    display: grid;
    gap: 10px;
    grid-template-columns: 1.2fr 1.8fr 140px 90px;
}

@media (max-width: 920px) {
    .login-shell {
        grid-template-columns: 1fr;
        max-width: 520px;
        min-height: 0;
    }

    .login-hero {
        padding: 30px;
    }

    .login-brand-mark {
        margin-bottom: 42px;
    }
}

@media (max-width: 820px) {
    .admin-body {
        display: block;
    }

    .admin-menu-open {
        overflow: hidden;
    }

    .admin-mobile-topbar {
        align-items: center;
        background: rgba(255, 255, 255, 0.96);
        border-bottom: 1px solid var(--admin-line);
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
        display: flex;
        gap: 12px;
        inset: 0 0 auto 0;
        min-height: 62px;
        padding: 10px 14px;
        position: fixed;
        z-index: 60;
    }

    .admin-mobile-topbar strong {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-mobile-topbar a {
        color: var(--admin-brand);
        flex: 0 0 auto;
        font-size: 13px;
        font-weight: 900;
    }

    .admin-sidebar {
        height: 100vh;
        left: 0;
        max-width: calc(100vw - 54px);
        padding-top: 76px;
        position: fixed;
        top: 0;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        width: 300px;
        z-index: 55;
    }

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

    .admin-mobile-menu-button {
        display: inline-grid;
    }

    .admin-menu-backdrop {
        background: rgba(15, 23, 42, 0.48);
        inset: 0;
        position: fixed;
        z-index: 50;
    }

    .admin-menu-open .admin-menu-backdrop {
        display: block;
    }

    .admin-sidebar nav {
        grid-template-columns: 1fr;
    }

    .admin-main {
        padding: 82px 16px 18px;
    }

    .admin-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 18px;
    }

    .admin-header-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .install-tracking-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .support-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .menu-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .admin-login-body {
        padding: 14px;
    }

    .login-shell {
        border-radius: 8px;
    }

    .login-hero,
    .login-card {
        padding: 24px;
    }

    .login-hero h1 {
        font-size: 32px;
    }

    .login-feature-list {
        display: grid;
    }

    .admin-sidebar nav,
    .admin-form-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-form button,
    .login-card button,
    .admin-button {
        width: 100%;
    }

    .system-status-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .login-card-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-language-selector,
    .admin-language-selector label,
    .admin-language-selector select {
        width: 100%;
    }

    .admin-table {
        min-width: 520px;
    }
}
