:root {
    --bg-main: #020617;
    --bg-card: #020617;
    --bg-card-soft: rgba(15,23,42,0.9);
    --bg-chip: rgba(15,23,42,0.85);
    --border-subtle: rgba(148,163,184,0.25);
    --text-main: #e5e7eb;
    --text-soft: #9ca3af;
    --accent: #3b82f6;
    --accent-soft: rgba(59,130,246,0.1);
    --accent-green: #22c55e;
    --accent-yellow: #eab308;
    --accent-danger: #ef4444;
    --radius-xl: 18px;
    --radius-lg: 14px;
    --radius-pill: 999px;
    --shadow-soft: 0 18px 45px rgba(15,23,42,0.85);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;  /* prevent full-page sideways scroll */
    background: radial-gradient(circle at top, #0f172a, #020617 55%);
    color: var(--text-main);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ===== SHARED LAYOUT (ALL PAGES) ===== */

.shell,
.main-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 60px auto 32px auto;
    padding: 0 16px 32px 16px;
    box-sizing: border-box;
}

/* Generic card container (for simpler pages like admin, vendor lists, etc.) */
.card-generic {
    background: var(--bg-card-soft);
    border-radius: var(--radius-xl);
    padding: 14px 16px;
    border: 1px solid rgba(15,23,42,0.9);
    box-shadow: var(--shadow-soft);
}

/* Header bar for admin / generic pages */
.top-bar {
    margin-bottom: 18px;
}
.top-bar h1 {
    margin: 0 0 6px 0;
    font-size: 20px;
    font-weight: 600;
}
.top-bar p {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}
.top-bar nav a {
    display: inline-block;
    margin-top: 8px;
    margin-right: 10px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}
.top-bar nav a:hover {
    text-decoration: underline;
}

/* ===== VENDOR MENU (top-left on vendor pages) ===== */

.menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    background: rgba(15,23,42,0.9);
    color: #e5e7eb;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.35);
    cursor: pointer;
    z-index: 50;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.menu-toggle span {
    font-weight: 500;
}
.menu-toggle::before {
    content: "☰";
    font-size: 16px;
}

.menu-panel {
    position: fixed;
    top: 48px;
    left: 12px;
    min-width: 210px;
    background: #020617;
    border-radius: 14px;
    border: 1px solid rgba(148,163,184,0.3);
    box-shadow: 0 18px 40px rgba(15,23,42,0.85);
    display: none;
    z-index: 40;
}
.menu-panel a {
    display: block;
    padding: 9px 14px;
    font-size: 14px;
    color: #e5e7eb;
    text-decoration: none;
}
.menu-panel a:hover {
    background: rgba(15,23,42,0.9);
}
.menu-divider {
    border-top: 1px solid rgba(148,163,184,0.25);
    margin: 4px 0;
}

/* ===== DASHBOARD LAYOUT ===== */

/* Stack hero + cards vertically on all screen sizes to avoid big empty sides */
.header-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

/* Brand / identity card */
.brand-card {
    flex: 1 1 260px;
    min-width: 260px;
    background: radial-gradient(circle at top left, rgba(59,130,246,0.45), rgba(15,23,42,0.9));
    border-radius: var(--radius-xl);
    padding: 10px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: var(--shadow-soft);
}
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: radial-gradient(circle at top, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e5e7eb;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 8px 20px rgba(37,99,235,0.7);
}
.brand-main {
    flex: 1;
}
.brand-main h1 {
    margin: 0 0 3px 0;
    font-size: 16px;
    font-weight: 600;
}
.brand-main p {
    margin: 0;
    font-size: 12px;
    color: var(--text-soft);
}
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    background: rgba(15,23,42,0.75);
    color: #e5e7eb;
    border: 1px solid rgba(148,163,184,0.3);
}
.chip-label {
    color: var(--text-soft);
}

/* Make sure hero never becomes ridiculously tall on large monitors */
@media (min-width: 1024px) {
    .brand-card {
        max-height: 120px;
    }
}

/* Summary cards grid (admin + vendor) */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 4px;
}

/* Small screens: stack cards in a single column */
@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .shell,
    .main-wrapper {
        padding-left: 12px;
        padding-right: 12px;
    }
}

.card {
    background: var(--bg-card-soft);
    border-radius: var(--radius-xl);
    padding: 12px 14px;
    border: 1px solid rgba(15,23,42,0.9);
    box-shadow: var(--shadow-soft);
    position: relative;
}
.card h3 {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: var(--text-soft);
    font-weight: 500;
}
.card-value {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}
.card-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    background: rgba(22,163,74,0.15);
    color: #bbf7d0;
    border: 1px solid rgba(74,222,128,0.4);
}
.card-pill.warn {
    background: rgba(234,179,8,0.08);
    color: #facc15;
    border-color: rgba(250,204,21,0.4);
}
.card-pill.muted {
    background: rgba(148,163,184,0.12);
    color: #e5e7eb;
    border-color: rgba(148,163,184,0.4);
}
.status-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    color: var(--text-soft);
}
.status-list li {
    display: flex;
    justify-content: space-between;
}

/* Filters row */
.filter-shell {
    margin-top: 8px;
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: minmax(0,1.8fr) minmax(0,1.4fr);
    gap: 10px;
}

.status-tabs {
    background: var(--bg-card-soft);
    border-radius: var(--radius-xl);
    padding: 4px;
    display: flex;
    gap: 4px;
    border: 1px solid var(--border-subtle);
}
.tab {
    flex: 1;
    text-align: center;
    border-radius: 999px;
    padding: 6px 4px;
    font-size: 12px;
    color: var(--text-soft);
    cursor: pointer;
    border: none;
    background: transparent;
}
.tab.active {
    background: var(--accent-soft);
    color: #e5e7eb;
    font-weight: 500;
}

.filter-row-right {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.select-shell {
    flex: 0 0 140px;
    background: var(--bg-card-soft);
    border-radius: var(--radius-lg);
    padding: 4px 8px;
    border: 1px solid var(--border-subtle);
}
.select-shell label {
    font-size: 11px;
    color: var(--text-soft);
    display: block;
    margin-bottom: 2px;
}
.select-shell select {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-size: 12px;
}

.search-shell {
    flex: 1;
    background: var(--bg-card-soft);
    border-radius: 999px;
    padding: 2px 10px 2px 10px;
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-icon {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: radial-gradient(circle at top, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}
.search-shell input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-size: 13px;
}
.search-shell button {
    border: none;
    background: var(--accent);
    color: #e5e7eb;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
}

/* Table section (vendor vouchers and others) */
.table-card {
    margin-top: 10px;
    background: var(--bg-card-soft);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(15,23,42,0.9);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}
.table-header {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(15,23,42,0.9);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}
.table-header h2 {
    margin: 0;
    font-size: 14px;
}
.table-header p {
    margin: 0;
    font-size: 12px;
    color: var(--text-soft);
}
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

/* Generic table style for all pages */
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
thead {
    background: rgba(15,23,42,0.9);
}
th, td {
    padding: 8px 10px;
    font-size: 12px;
    border-bottom: 1px solid rgba(30,41,59,0.9);
    white-space: nowrap;
}
th {
    text-align: left;
    color: var(--text-soft);
    font-weight: 500;
}
tbody tr:hover {
    background: rgba(15,23,42,0.9);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: lowercase;
}
.status-pill.unused {
    background: rgba(34,197,94,0.18);
    color: #bbf7d0;
}
.status-pill.used {
    background: rgba(59,130,246,0.18);
    color: #bfdbfe;
}
.status-pill.expired {
    background: rgba(234,179,8,0.2);
    color: #facc15;
}
.status-pill.disabled {
    background: rgba(148,163,184,0.22);
    color: #e5e7eb;
}

.muted {
    color: var(--text-soft);
}
.code-cell {
    font-family: "JetBrains Mono", Menlo, Consolas, monospace;
    font-size: 12px;
}
.empty-state {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-soft);
}

/* ===== LOGIN & FORM UTILITIES (used by login.php, simple admin pages, etc.) ===== */

.login-container {
    background: var(--bg-card-soft);
    padding: 24px 22px;
    border-radius: var(--radius-xl);
    max-width: 380px;
    width: 100%;
    margin: 96px auto 40px auto;
    text-align: center;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(15,23,42,0.9);
}

input,
select,
textarea {
    width: 100%;
    margin: 8px 0;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148,163,184,0.5);
    background: rgba(15,23,42,0.95);
    color: var(--text-main);
    font-size: 14px;
}
input::placeholder,
textarea::placeholder {
    color: #6b7280;
}

button,
.btn {
    background: var(--accent);
    color: #fff;
    padding: 9px 16px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
button:hover,
.btn:hover {
    background: #2563eb;
}

.logout {
    display: inline-block;
    margin-top: 20px;
    color: #fff;
    background: #dc3545;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 999px;
}

/* Messages */
.message {
    background: rgba(22,163,74,0.15);
    border: 1px solid rgba(74,222,128,0.4);
    color: #bbf7d0;
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 13px;
}
.error {
    background: rgba(248,113,113,0.15);
    border: 1px solid rgba(248,113,113,0.6);
    color: #fecaca;
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 13px;
}

/* Simple container class for non-dashboard vendor pages (generate / sites, etc.) */
.container {
    max-width: 900px;
    margin: 80px auto 30px auto;
    padding: 0 16px;
}
.subtitle {
    color: var(--text-soft);
    margin-bottom: 20px;
    font-size: 13px;
}

/* Simple white-ish card for forms on those pages */
.form-card {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 20px;
    background: rgba(15,23,42,0.9);
    border: 1px solid rgba(51,65,85,0.85);
}
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}
.form-row label {
    flex: 1 1 200px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
}

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

@media (max-width: 960px) {
    .shell,
    .main-wrapper {
        margin-top: 70px;
        padding: 0 10px 24px 10px;
    }
    .summary-grid {
        width: 100%;
    }
    .filter-shell {
        grid-template-columns: minmax(0,1fr);
    }
    .filter-row-right {
        flex-direction: column;
    }
    .select-shell {
        flex: 1;
    }
    table {
        min-width: 640px;
    }
}

@media (max-width: 640px) {
    .brand-card {
        padding: 10px 12px;
    }
    .card {
        padding: 10px 12px;
    }
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .menu-toggle {
        padding: 7px 12px;
    }
    .container {
        margin: 70px auto 20px auto;
        padding: 0 10px;
    }

    /* Phone tweaks: let the table fit and wrap text */
    table {
        min-width: 100%;
    }
    th, td {
        white-space: normal;
    }
}

/* Tablets and small laptops (768px–1024px) are already handled smoothly
   by the fluid widths and the 960px breakpoint above.
   On large desktops, the max-width on .shell / .main-wrapper keeps text readable. */
