/* =========================
   ROOT VARIABLES
========================= */
:root {
    color-scheme: dark;
    --bg: #04120c;
    --bg-soft: #0b2017;
    --card: #0f1f17;
    --card-alt: #12261d;
    --border: #1d4031;

    --primary: #34d399;
    --primary-dark: #10b981;
    --primary-ink: #052e1f;

    --text: #ecfdf5;
    --muted: #bfd8cf;

    --danger: #f87171;
    --success: #4ade80;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4faf7;
    --bg-soft: #e8f3ee;
    --card: #ffffff;
    --card-alt: #f0f7f3;
    --border: #c6ddd0;

    --primary: #0f9b6a;
    --primary-dark: #0b7f57;
    --primary-ink: #f8fffb;

    --text: #0b2b20;
    --muted: #35574b;

    --danger: #dc2626;
    --success: #15803d;
}

/* =========================
   GLOBAL RESET
========================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(52, 211, 153, 0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(16, 185, 129, 0.12), transparent 22%),
        linear-gradient(180deg, var(--bg-soft), var(--bg));
    color: var(--text);
}

[data-theme="light"] body,
body[data-theme="light"] {
    background:
        radial-gradient(circle at top left, rgba(15, 155, 106, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(16, 185, 129, 0.08), transparent 22%),
        linear-gradient(180deg, var(--bg-soft), var(--bg));
}

/* =========================
   LAYOUT
========================= */
.container {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* =========================
   HEADER
========================= */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;

    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(5,46,31,0.98), rgba(4,18,12,0.98));
    border-bottom: 1px solid var(--border);
}

:root[data-theme="light"] .header,
body[data-theme="light"] .header {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(240,247,243,0.98));
}

:root[data-theme="light"] .header a,
body[data-theme="light"] .header a {
    color: #0b7f57;
}

.header h1 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--primary);
}

.header a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    cursor: pointer;
    width: auto;
    flex: 0 0 auto;
}

:root[data-theme="light"] .theme-toggle,
body[data-theme="light"] .theme-toggle {
    background: rgba(15, 155, 106, 0.07);
    color: #0b2b20;
}

.theme-toggle:hover {
    border-color: var(--primary);
}

.theme-toggle-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
}

.theme-toggle-label {
    font-size: 0.8rem;
}

.connectivity-banner {
    position: sticky;
    top: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: #f59e0b;
    color: #1f1300;
    border-bottom: 1px solid rgba(31, 19, 0, 0.18);
    font-weight: 600;
}

.connectivity-banner.is-visible {
    display: flex;
}

.connectivity-banner button {
    width: auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.2);
    color: inherit;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    min-width: 0;
}

.brand:hover {
    opacity: 0.95;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

:root[data-theme="light"] .brand-mark,
body[data-theme="light"] .brand-mark {
    box-shadow: 0 0 0 1px rgba(15, 155, 106, 0.14);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-copy strong {
    color: var(--text);
    font-size: 0.98rem;
    line-height: 1.1;
}

.brand-copy small {
    color: var(--muted);
    margin-top: 2px;
    font-size: 0.78rem;
    line-height: 1.45;
}

/* =========================
   CARDS
========================= */
.card {
    background: linear-gradient(180deg, rgba(18, 38, 29, 0.96), rgba(15, 31, 23, 0.96));
    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 14px;
    margin-bottom: 12px;

    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

:root[data-theme="light"] .card,
body[data-theme="light"] .card {
    background: linear-gradient(180deg, #ffffff, #f4fbf7);
    border-color: #c6ddd0;
    box-shadow: 0 8px 18px rgba(11, 43, 32, 0.08);
}

:root[data-theme="light"] .card strong,
:root[data-theme="light"] .card h1,
:root[data-theme="light"] .card h2,
:root[data-theme="light"] .card h3,
body[data-theme="light"] .card strong,
body[data-theme="light"] .card h1,
body[data-theme="light"] .card h2,
body[data-theme="light"] .card h3 {
    color: #0b2b20;
}

/* =========================
   BUTTONS
========================= */
.btn {
    display: inline-block;
    width: 100%;

    padding: 12px;
    border-radius: 10px;
    border: none;

    font-weight: 600;
    font-size: 0.95rem;

    text-align: center;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-primary:hover {
    background: #6ee7b7;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* =========================
   FORMS
========================= */
.form-group {
    margin-bottom: 12px;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 4px;
    line-height: 1.45;
}

input,
select {
    width: 100%;
    padding: 10px 12px;

    border-radius: 8px;
    border: 1px solid var(--border);

    background: rgba(3, 11, 8, 0.95);
    color: var(--text);
}

:root[data-theme="light"] input,
:root[data-theme="light"] select,
body[data-theme="light"] input,
body[data-theme="light"] select {
    background: #ffffff;
    color: #0b2b20;
    border-color: #c6ddd0;
}

:root[data-theme="light"] input::placeholder,
body[data-theme="light"] input::placeholder {
    color: #5e7d70;
}

input::placeholder {
    color: #6b9082;
}

/* =========================
   TABLES (mobile friendly)
========================= */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    text-align: left;
    color: var(--muted);
    padding: 8px 6px;
    line-height: 1.45;
}

.table td {
    padding: 8px 6px;
    border-top: 1px solid var(--border);
    line-height: 1.5;
}

/* =========================
   BADGES
========================= */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.badge-success {
    background: rgba(34,197,94,0.15);
    color: var(--success);
}

.badge-danger {
    background: rgba(239,68,68,0.15);
    color: var(--danger);
}

.card small,
.layout-brand small,
.brand-copy small,
.muted {
    line-height: 1.5;
    font-weight: 500;
}

:root[data-theme="light"] .card small,
:root[data-theme="light"] .layout-brand small,
:root[data-theme="light"] .brand-copy small,
:root[data-theme="light"] .muted,
body[data-theme="light"] .card small,
body[data-theme="light"] .layout-brand small,
body[data-theme="light"] .brand-copy small,
body[data-theme="light"] .muted {
    color: #274237;
}

/* =========================
   LINKS
========================= */
a {
    color: var(--primary);
    text-decoration: none;
}

/* =========================
   UTILITIES
========================= */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }

.flex {
    display: flex;
    gap: 10px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Improve vertical rhythm */
.container {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* Card spacing */
.card {
    margin-bottom: 16px;   /* was too tight */
    padding: 16px;
    border-radius: 14px;
}

/* Section spacing */
.section {
    margin-bottom: 20px;
}

/* Improve text hierarchy */
.card strong {
    font-size: 1rem;
}

.card small {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}

/* Action row spacing */
.card .actions {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons inside cards */
.card .btn {
    width: auto;
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* Clickable cards */
a.card {
    display: block;
    text-decoration: none;
    color: inherit;
}

a.card:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Dashboard cards with accents */
.card-nav {
    position: relative;
    padding-left: 14px;
    border-left: 4px solid var(--border);
}

/* Accent colors */
.card-yellow { border-left-color: #facc15; }
.card-blue   { border-left-color: #3b82f6; }
.card-green  { border-left-color: #22c55e; }
.card-purple { border-left-color: #a855f7; }

.card-emerald { border-left-color: var(--primary); }

/* Icon styling */
.card-nav .icon {
    font-size: 1.2rem;
    margin-right: 6px;
}

/* Improve spacing inside card */
.card-nav strong {
    display: block;
}

.card-nav small {
    display: block;
    margin-top: 2px;
}

.hero-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.hero-brand img {
    width: min(100%, 360px);
    height: auto;
    display: block;
}

.hero-brand h2 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--primary);
}

.hero-brand small {
    margin: 0;
    color: var(--muted);
}

/* -------------------------
   Final light-theme overrides
   Keep this near file end so it wins.
-------------------------- */
html[data-theme="light"] .card,
html[data-theme="light"] a.card {
    background: linear-gradient(180deg, #ffffff, #f4fbf7) !important;
    border-color: #c6ddd0 !important;
}

html[data-theme="light"] .card strong,
html[data-theme="light"] .card h1,
html[data-theme="light"] .card h2,
html[data-theme="light"] .card h3,
html[data-theme="light"] .card small,
html[data-theme="light"] .card,
html[data-theme="light"] .brand-copy strong,
html[data-theme="light"] .brand-copy small,
html[data-theme="light"] .header,
html[data-theme="light"] .header a,
html[data-theme="light"] .theme-toggle,
html[data-theme="light"] .theme-toggle-label {
    color: #0b2b20 !important;
}

html[data-theme="light"] .card small,
html[data-theme="light"] .muted {
    color: #274237 !important;
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
    background: #ffffff !important;
    color: #0b2b20 !important;
    border-color: #c6ddd0 !important;
}

html[data-theme="light"] .card-nav {
    border-left-width: 4px;
}