/* Shiva Governance — Design System (matches marketing site) */
:root {
    --bg:          #030712;
    --bg-card:     rgba(2, 6, 23, 0.4);
    --border:      rgba(148, 163, 184, 0.08);
    --border-subtle: rgba(148, 163, 184, 0.05);
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;
    --amber:    #f59e0b;
    --emerald:  #10b981;
    --rose:     #f43f5e;
    --cyan:     #06b6d4;
    --font-mono: 'Courier New', Courier, monospace;
    --transition: 0.15s ease;
    --glow-amber: 0 0 60px rgba(245, 158, 11, 0.08);
    --glow-emerald: 0 0 40px rgba(16, 185, 129, 0.1);
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-3xl: 28px;

    /* backwards-compat aliases used in index.html inline styles */
    --color-amber:   #f59e0b;
    --color-emerald: #10b981;
    --color-rose:    #f43f5e;
    --color-cyan:    #06b6d4;
    --border-color:  rgba(148, 163, 184, 0.08);
    --bg-primary:    #030712;
    --bg-secondary:  rgba(2, 6, 23, 0.4);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--amber); color: var(--bg); }

/* ── App shell ───────────────────────────────────────────────────────────────
   Everything below is scoped under #view-app so the app's structural element
   styles (header/main/footer/nav/code/a) never touch the Tailwind marketing
   landing, which lives in #view-landing and styles itself with utilities. */
#view-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    color: var(--text-secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    letter-spacing: -0.01em;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#view-app > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    height: 64px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.8);
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo { text-decoration: none; }

.logo-text {
    font-size: 22px;
    font-weight: 300;
    color: var(--text-primary);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.logo-text span {
    font-weight: 700;
    color: var(--amber);
}

#view-app nav { display: flex; gap: 2px; align-items: center; }
#view-app nav.hidden { display: none; }

#view-app nav button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
}

#view-app nav button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

#view-app nav button.active {
    color: var(--emerald);
    background: rgba(16, 185, 129, 0.1);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--emerald);
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    padding: 6px 14px;
}

.status-badge.hidden { display: none; }

.status-dot {
    width: 6px; height: 6px;
    background: var(--emerald);
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    50%       { opacity: 0.7; box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}

/* ── Main / Footer ───────────────────────────────────────────────────────── */
#view-app > main {
    flex: 1;
    padding: 32px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

#view-app > footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    border-top: 1px solid rgba(15, 23, 42, 0.8);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
    text-transform: uppercase;
    background: rgba(3, 7, 18, 0.6);
}

/* ── Stages ──────────────────────────────────────────────────────────────── */
.stage { display: none; }
.stage.active { display: block; }

/* ── Auth Layout ─────────────────────────────────────────────────────────── */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 32px 16px;
}

.auth-card {
    background: rgba(2, 6, 23, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-3xl);
    padding: 44px 40px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--glow-amber), 0 32px 80px rgba(0, 0, 0, 0.6);
    position: relative;
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-3xl);
    background: radial-gradient(ellipse at top, rgba(245, 158, 11, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: rgba(2, 6, 23, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: var(--radius-2xl);
    padding: 28px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: rgba(148, 163, 184, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card-title {
    font-size: 22px;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 8px;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: rgba(11, 20, 36, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.06);
}

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

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23475569' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-color: rgba(11, 20, 36, 0.8);
    padding-right: 40px;
}

select.form-control option { background: #0b1424; color: var(--text-primary); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: block;
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    text-align: center;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--amber);
    color: #030712;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.25);
}

.btn-primary:hover {
    background: #fbbf24;
    transform: translateY(-1px);
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.35);
}

.btn-secondary {
    background: rgba(16, 185, 129, 0.1);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.btn-secondary:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.btn-outline:hover {
    color: var(--text-primary);
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

/* ── Auth toggle ─────────────────────────────────────────────────────────── */
.auth-toggle {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-toggle a {
    color: var(--amber);
    text-decoration: none;
    font-weight: 600;
    transition: opacity var(--transition);
}

.auth-toggle a:hover { opacity: 0.8; text-decoration: underline; }

/* ── Dashboard Grid ──────────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.stat-value {
    font-size: 36px;
    font-weight: 200;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 10px;
    letter-spacing: -0.03em;
}

.stat-subtext { font-size: 12px; color: var(--text-muted); }

/* ── Console Split / Panel ───────────────────────────────────────────────── */
.console-split {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 16px;
}

.panel {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
    align-items: start;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
    text-align: left;
    padding: 10px 16px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
    white-space: nowrap;
}

td {
    padding: 14px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(148, 163, 184, 0.04);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.015); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.badge-allow    { background: rgba(16,185,129,.12); color: var(--emerald); border: 1px solid rgba(16,185,129,.25); }
.badge-block    { background: rgba(244,63,94,.12);  color: var(--rose);    border: 1px solid rgba(244,63,94,.25); }
.badge-review   { background: rgba(245,158,11,.12); color: var(--amber);   border: 1px solid rgba(245,158,11,.25); }
.badge-trusted  { background: rgba(16,185,129,.08); color: var(--emerald); border: 1px solid rgba(16,185,129,.2); }
.badge-suspicious { background: rgba(244,63,94,.08); color: var(--rose);   border: 1px solid rgba(244,63,94,.2); }
.badge-observed { background: rgba(245,158,11,.08); color: var(--amber);   border: 1px solid rgba(245,158,11,.2); }
.badge-limited  { background: rgba(148,163,184,.08); color: var(--text-secondary); border: 1px solid rgba(148,163,184,.15); }

/* ── Hash / Mono text ────────────────────────────────────────────────────── */
.hash-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
}

/* ── API Key Display ─────────────────────────────────────────────────────── */
.api-key-container {
    background: rgba(3, 7, 18, 0.8);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
}

.api-key-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.api-key-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--amber);
    word-break: break-all;
    line-height: 1.6;
    user-select: all;
}

/* ── Audit Chain Timeline ────────────────────────────────────────────────── */
.chain-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 4px;
}

.chain-timeline::-webkit-scrollbar { width: 3px; }
.chain-timeline::-webkit-scrollbar-track { background: transparent; }
.chain-timeline::-webkit-scrollbar-thumb { background: rgba(148,163,184,.12); border-radius: 2px; }

.chain-node { display: flex; gap: 12px; align-items: flex-start; }

.chain-icon {
    flex-shrink: 0;
    width: 46px; height: 46px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--amber);
}

.chain-content {
    flex: 1;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(148,163,184,.07);
    border-radius: 14px;
    padding: 14px 16px;
    min-width: 0;
}

.chain-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 4px;
}

/* ── Toast Notifications ─────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    pointer-events: none;
}

.toast {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid;
    animation: toastIn 0.25s ease forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    backdrop-filter: blur(12px);
}

@keyframes toastIn {
    from { transform: translateX(60px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.toast.success { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); color: var(--emerald); }
.toast.error   { background: rgba(244,63,94,.12);  border-color: rgba(244,63,94,.3);  color: var(--rose); }
.toast.warning { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: var(--amber); }
.toast.info    { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); color: #60a5fa; }

/* ── Utility ─────────────────────────────────────────────────────────────────
   Scope the !important page-switch toggle to the two top-level view containers
   ONLY. A global `.hidden { !important }` would clobber Tailwind's own `.hidden`
   wherever the marketing landing uses the `hidden md:flex` / `hidden lg:flex`
   show-on-desktop pattern (top nav, the Platform hub connector arrows, etc.),
   forcing them hidden at every width. */
#view-landing.hidden,
#view-app.hidden { display: none !important; }

.tab-view { animation: fadeIn 0.18s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

#view-app code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: rgba(245, 158, 11, 0.08);
    padding: 2px 7px;
    border-radius: 5px;
    color: var(--amber);
}

#view-app a { color: var(--amber); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .console-split, .panel { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    #view-app > main { padding: 16px; }
    #view-app > header { padding: 12px 16px; flex-wrap: wrap; gap: 12px; height: auto; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .auth-card { padding: 28px 20px; }
    .stat-value { font-size: 28px; }
    #view-app > footer { flex-direction: column; gap: 4px; text-align: center; }
    .toast-container { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}
