/* midas.cc - one stylesheet, no JavaScript. Light and dark via tokens. */

:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0eee8;
    --text: #1b1a17;
    --muted: #67635a;
    --border: #dedad0;
    --brand: #ffd100;
    --brand-ink: #1b1a17;
    --accent: #0b5cad;
    --accent-ink: #ffffff;
    --danger: #b3261e;
    --danger-bg: #fdecea;
    --ok: #1e6b34;
    --ok-bg: #e7f4ea;
    --warn-bg: #fff6d6;
    --focus: #0b5cad;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .05);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121210;
        --surface: #1c1b18;
        --surface-2: #262521;
        --text: #eeebe3;
        --muted: #a8a397;
        --border: #34322c;
        --brand: #ffd100;
        --brand-ink: #121210;
        --accent: #6cb0ff;
        --accent-ink: #0b1a2a;
        --danger: #ff8a80;
        --danger-bg: #3a1a17;
        --ok: #7fd394;
        --ok-bg: #16301e;
        --warn-bg: #3a3218;
        --focus: #6cb0ff;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; overflow-wrap: anywhere; }

/* ---------- chrome ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; }
.brand-logo { display: block; height: 40px; width: auto; }
.brand-text { font-size: 1.15rem; }
.login-logo { display: block; width: 220px; max-width: 70%; height: auto; margin: 8px auto 20px; }
.topnav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topnav a { text-decoration: none; font-weight: 500; }
.inline-form { display: inline; margin: 0; }
.link-button {
    background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
    cursor: pointer; font-weight: 500;
}

.page { width: 100%; max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.page-wide { max-width: 1100px; }

.footer {
    padding: 24px 16px 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: .875rem;
    color: var(--muted);
}
.footer nav { display: flex; justify-content: center; gap: 1.25rem; flex-wrap: wrap; margin-bottom: .5rem; }
.footer p { margin: .25rem 0; }

/* ---------- surfaces ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.card > :first-child { margin-top: 0; }

.notice { border-radius: 10px; padding: 12px 14px; margin: 12px 0; border: 1px solid transparent; }
.notice-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.notice-ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.notice-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--brand) 50%, transparent); }

/* ---------- forms ---------- */

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: .875rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=tel], input[type=search], input[type=number], select, textarea {
    width: 100%;
    font: inherit;
    font-size: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}
textarea { min-height: 90px; }
input[type=file] { font: inherit; max-width: 100%; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 16px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.check label { font-weight: 400; font-size: .925rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 44px; padding: 10px 18px;
    border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    background: var(--brand); color: var(--brand-ink);
}
.btn:hover { filter: brightness(.96); }
.btn-block { width: 100%; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { min-height: 34px; padding: 6px 12px; font-size: .875rem; }

.form-links { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 12px; font-size: .925rem; }

/* ---------- apps ---------- */

.app-list { display: grid; gap: 14px; }
.app {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.app-icon { width: 56px; height: 56px; border-radius: 13px; object-fit: cover; background: var(--surface-2); }
.app h2 { margin: 0; font-size: 1.1rem; }
.app .meta { font-size: .85rem; color: var(--muted); }
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.app-actions .btn { min-height: 40px; padding: 8px 14px; }
.app-actions img { width: 18px; height: 18px; }
.app details { margin-top: 8px; font-size: .925rem; }
.app summary { cursor: pointer; color: var(--accent); }
.app-body { grid-column: 2; min-width: 0; }

.platform-note { font-size: .875rem; }

/* ---------- tables (admin) ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.center, th.center { text-align: center; }

.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.admin-nav a {
    padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); text-decoration: none; color: var(--text); font-size: .9rem;
}
.admin-nav a.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1 1 180px; margin-bottom: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .8rem; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-bad { background: var(--danger-bg); color: var(--danger); }

.qr { background: #fff; padding: 12px; border-radius: 10px; display: inline-block; }
.qr img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }

video { width: 100%; border-radius: var(--radius); background: #000; }
.help-shot { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }
ol.steps li { margin-bottom: .5rem; }
.mt-24 { margin-top: 24px; }
