﻿:root {
    --bg: #f3f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --text: #15223b;
    --muted: #6a7891;
    --line: #dbe6f3;
    --brand-1: #0ea5b7;
    --brand-2: #2563eb;
    --brand-3: #0f4fbf;
    --success: #0f9f6e;
    --danger: #d7374f;
    --warning: #d28a17;
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow: 0 18px 40px rgba(21, 34, 59, 0.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 0 0, #e9f7fb 0, #f3f7fb 40%, #f3f7fb 100%);
}

a {
    color: #135fd1;
    text-decoration: none;
}

a:hover { text-decoration: underline; }

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

.main-content {
    padding: 28px 0 46px;
    min-height: calc(100vh - 160px);
}

body.admin-area {
    background: radial-gradient(circle at 0 0, #fff4e8 0, #f7f5f2 45%, #f7f5f2 100%);
}

body.admin-standalone {
    background: #101723;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
}

.navbar .flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    gap: 12px;
}

.navbar-brand {
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #0d3b87;
    font-size: 24px;
}

.navbar-nav {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.nav-link {
    padding: 10px 13px;
    border-radius: 999px;
    color: #21436d;
    font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
    background: #edf4ff;
    text-decoration: none;
}

.navbar-toggle {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
}

.page-header {
    border-radius: var(--radius-lg);
    padding: 22px;
    color: #fff;
    background: linear-gradient(120deg, var(--brand-1), var(--brand-2));
    box-shadow: 0 20px 42px rgba(37, 99, 235, 0.26);
    margin-bottom: 20px;
}

.page-header .top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.page-title {
    font-weight: 800;
    font-size: 28px;
}

.page-subtitle {
    opacity: 0.9;
    font-size: 18px;
    margin-left: 8px;
}

.page-meta {
    color: rgba(255, 255, 255, 0.92);
    font-size: 14px;
}

.quick-nav {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    font-weight: 600;
}

.quick-nav a:hover {
    background: rgba(255, 255, 255, 0.24);
    text-decoration: none;
}

.workspace-strip {
    border: 1px solid var(--line);
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.workspace-title {
    font-weight: 800;
    color: #103b7d;
}

.workspace-meta {
    color: #5d6f8a;
    font-size: 14px;
}

.admin-console {
    border-radius: 14px;
    border: 1px solid #f1c9a8;
    background: linear-gradient(120deg, #8a3d0d, #c96d25);
    color: #fff;
    padding: 14px;
    margin-bottom: 16px;
    box-shadow: 0 12px 32px rgba(114, 54, 12, 0.22);
}

.admin-console-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.admin-console-title {
    font-size: 20px;
    font-weight: 800;
}

.admin-console-meta {
    font-size: 14px;
    opacity: .95;
}

.admin-console-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-console-nav a {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 14px;
    font-weight: 700;
}

.admin-console-nav a.active,
.admin-console-nav a:hover {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.28);
}

.admin-layout {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: linear-gradient(180deg, #131f34, #1c2f4e);
    color: #dbe9ff;
    padding: 18px 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-brand {
    display: block;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin-bottom: 8px;
}

.admin-user {
    font-size: 13px;
    color: #a8bfdf;
    margin-bottom: 14px;
    word-break: break-word;
}

.admin-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-menu a {
    color: #d4e5ff;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 9px 11px;
    font-weight: 600;
}

.admin-menu a.active,
.admin-menu a:hover {
    background: rgba(65, 132, 255, 0.25);
    border-color: rgba(125, 178, 255, 0.5);
    text-decoration: none;
    color: #fff;
}

.admin-sidebar-actions {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-main {
    background: #f3f7fe;
    padding: 18px;
    min-width: 0;
}

.admin-topbar {
    border-radius: 14px;
    border: 1px solid #d5e4fb;
    background: #ffffff;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.admin-page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.admin-page-head h2 {
    margin: 0;
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.settings-group {
    border-left: 4px solid #2c6ce3;
}

.settings-group-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.settings-group-head h3 {
    margin: 0;
}

.settings-items {
    display: grid;
    gap: 10px;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.setting-delete-form {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.admin-topbar-title {
    font-size: 22px;
    font-weight: 800;
    color: #12396f;
}

.admin-topbar-subtitle {
    color: #627591;
    font-size: 14px;
    margin-top: 4px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
}

.card h2, .card h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.hero-card {
    background: linear-gradient(135deg, #0b7fa0 0%, #2563eb 55%, #3b82f6 100%);
    color: #fff;
    border: none;
    position: relative;
    overflow: hidden;
}

.hero-card h1, .hero-card h2, .hero-card h3, .hero-card p {
    color: #fff;
}

.hero-card::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    right: -100px;
    top: -100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.hero-chip {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
}

.text-muted { color: var(--muted); }

.grid {
    display: grid;
    gap: 16px;
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }

.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-2, .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; gap: 14px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #eaf2ff;
    color: #2053b2;
}

.badge-success { background: #e7fbf3; color: #0b8d60; }
.badge-primary { background: #eaf2ff; color: #2053b2; }

.line-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    background: var(--surface-soft);
    margin-bottom: 10px;
}

.tool-card { height: 100%; }

.surface-soft {
    background: #f8fbff;
    border: 1px solid #d9e7f7;
    border-radius: 14px;
    padding: 14px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.section-title-row h3,
.section-title-row h2 {
    margin: 0;
}

.table-lite {
    width: 100%;
    border-collapse: collapse;
}

.table-lite th,
.table-lite td {
    border-bottom: 1px solid #dbe6f3;
    padding: 10px 8px;
    text-align: left;
    font-size: 14px;
}

.table-lite th {
    color: #4c5f7d;
    font-weight: 700;
}

.package-card {
    position: relative;
}

.package-card.popular {
    border: 2px solid #2f6fe4;
}

.ribbon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #2f6fe4;
    color: #fff;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.tool-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tool-name {
    margin: 0;
}

.status-completed { background: #e8fbf1; color: #0d8b5e; }
.status-pending { background: #fff4df; color: #ae6800; }
.status-failed, .status-refunded { background: #ffeaf0; color: #bd2748; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    border-radius: 14px;
    border: 1px solid #d7e6f8;
    background: #fff;
    padding: 14px;
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #12396f;
}

form { margin: 0; }

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0 6px;
}

input, textarea, select {
    width: 100%;
    border: 1px solid #cfddee;
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid rgba(37, 99, 235, 0.2);
    border-color: #8bb4ff;
}

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

.inline-check { width: auto; }

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
}

.btn-primary, button[type="submit"] {
    background: linear-gradient(120deg, #0f8da9, #2563eb);
    color: #fff;
}

.btn-primary:hover, button[type="submit"]:hover { filter: brightness(1.06); text-decoration: none; }

.btn-secondary {
    border-color: #c8d9f0;
    background: #f2f7ff;
    color: #1f4b9f;
}

.btn-sm { padding: 8px 12px; font-size: 14px; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 14px; }
.mt-12 { margin-top: 24px; }
.mb-6 { margin-bottom: 16px; }
.row-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f5f9ff; border-radius: 10px; border: 1px solid var(--line); padding: 14px; }
.error { color: var(--danger); }
.tight-title { margin: 0 0 4px; }
.auth-shell { max-width: 680px; margin: 0 auto; }
.auth-hero { text-align: center; margin-bottom: 10px; }
.auth-hero h2 { margin-bottom: 8px; }
.auth-hero p { margin: 0; color: #d7e8ff; }

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: .92;
}

.btn-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.content-body {
    line-height: 1.8;
    margin-top: 14px;
}

.content-body p { margin: 0 0 12px; }

.admin-shortcuts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.shortcut {
    border: 1px solid var(--line);
    background: #f8fbff;
    border-radius: 12px;
    padding: 12px;
}

.shortcut h4 {
    margin: 0 0 6px;
    font-size: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
}

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

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid;
}

.alert-success { background: #e9fbf4; border-color: #b8edd6; color: #0b8d60; }
.alert-error { background: #ffeef2; border-color: #ffc9d3; color: #c32246; }

.site-footer {
    border-top: 1px solid var(--line);
    background: #fff;
    color: #607089;
    padding: 18px 0;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-wrap {
    margin-top: 12px;
}

.pagination {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid #ccddf4;
    background: #fff;
    color: #1e468a;
    font-weight: 600;
    text-decoration: none;
}

.pagination li.active span {
    background: linear-gradient(120deg, #0f8da9, #2563eb);
    color: #fff;
    border-color: transparent;
}

.pagination li.disabled span {
    color: #8c9ab2;
    background: #f4f8ff;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 1024px) {
    .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .container { width: calc(100% - 22px); }
    .navbar-toggle { display: inline-flex; }
    .navbar-nav {
        position: absolute;
        top: 76px;
        right: 10px;
        left: 10px;
        border: 1px solid var(--line);
        background: #fff;
        border-radius: 14px;
        padding: 10px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        box-shadow: var(--shadow);
    }
    .navbar-nav.open { display: flex; }
    .navbar-nav li { width: 100%; }
    .navbar-nav .nav-link,
    .navbar-nav .btn,
    .navbar-nav .inline-form button {
        width: 100%;
        justify-content: center;
    }
    .grid-cols-3, .grid-cols-2, .two-col { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .admin-shortcuts { grid-template-columns: 1fr; }
    .card { padding: 16px; border-radius: 14px; }
    .page-header { padding: 16px; }
    .page-title { font-size: 24px; }
    .page-subtitle { display: block; margin-left: 0; font-size: 16px; margin-top: 4px; }
    .table-lite th:nth-child(3),
    .table-lite td:nth-child(3) {
        display: none;
    }
    .workspace-strip {
        flex-direction: column;
        align-items: flex-start;
    }
    .admin-console-top {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .admin-sidebar {
        position: static;
        height: auto;
    }

    .admin-main {
        padding: 12px;
    }
    .admin-grid-2 {
        grid-template-columns: 1fr;
    }
    .setting-row {
        grid-template-columns: 1fr;
    }
    .setting-delete-form {
        justify-content: flex-start;
    }
}
