:root {
    --bg: #f8f9fa; --surface: #fff; --surface-2: #f9fafb;
    --border: #e8e8e8; --border-strong: #d1d5db;
    --text: #1a1a1a; --text-muted: #666; --text-faint: #999; --text-fainter: #ccc;
    --accent: #e94560;
    --green: #22c55e; --green-dark: #16a34a; --green-bg: #dcfce7;
    --blue: #3b82f6; --blue-dark: #2563eb; --blue-bg: #dbeafe;
    --red: #ef4444; --red-dark: #dc2626; --red-bg: #fef2f2;
    --orange: #f59e0b; --orange-dark: #d97706;
    --purple: #8b5cf6; --purple-dark: #7c3aed;
    --teal: #14b8a6; --teal-dark: #0d9488;
    --pink: #ec4899; --pink-dark: #db2777;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 5px 16px rgba(0,0,0,0.1);
    --radius: 12px; --radius-lg: 14px;
}
:root[data-theme="dark"] {
    --bg: #0f1115; --surface: #1a1d24; --surface-2: #22262f;
    --border: #2a2e37; --border-strong: #3a3f4b;
    --text: #f0f0f0; --text-muted: #a0a5b0; --text-faint: #6b7280; --text-fainter: #4b5563;
    --green-bg: #14532d; --blue-bg: #1e3a8a; --red-bg: #7f1d1d;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 5px 16px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--text);
    min-height: 100vh; -webkit-font-smoothing: antialiased;
    transition: background 0.2s, color 0.2s;
}

.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.875rem 1.5rem; background: var(--surface);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.navbar a, .navbar span { text-decoration: none; font-weight: 500; color: var(--text); }
.nav-title { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.3px; }
.nav-right { display: flex; gap: 0.75rem; align-items: center; }
.nav-btn {
    background: transparent; border: none; color: var(--text-muted);
    font-size: 0.875rem; cursor: pointer; font-family: inherit;
    padding: 0.375rem 0.5rem; border-radius: 6px; transition: color 0.15s, background 0.15s;
    display: inline-flex; align-items: center; gap: 4px;
}
.nav-btn:hover { color: var(--text); background: var(--surface-2); }

main { max-width: 720px; margin: 2rem auto; padding: 0 1rem; }
main.wide { max-width: 1200px; }

h1, h2, h3 { letter-spacing: -0.3px; color: var(--text); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; font-weight: 600; }

.section { margin-bottom: 2rem; }

/* Home tiles — modernized: white cards with colored icon */
.tile-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.875rem;
}
.tile {
    display: flex; align-items: center; gap: 0.875rem;
    padding: 1.125rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    text-decoration: none; color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.tile-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.375rem; color: #fff; font-weight: 700; flex-shrink: 0;
}
.tile-icon.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.tile-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.tile-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.tile-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.tile-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.tile-icon.teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.tile-icon.pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.tile-text { flex: 1; min-width: 0; }
.tile-title { font-weight: 600; font-size: 1rem; margin-bottom: 2px; }
.tile-sub { font-size: 0.8125rem; color: var(--text-muted); }

/* Form base */
input, select, textarea {
    display: block; width: 100%; margin-bottom: 0.75rem; padding: 0.625rem 0.75rem;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 8px; color: var(--text);
    font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
    outline: none;
}
textarea { min-height: 100px; resize: vertical; }

button {
    display: block; width: 100%; margin-bottom: 0.75rem; padding: 0.625rem 0.75rem;
    background: var(--text); border: none; cursor: pointer;
    font-weight: 600; color: var(--surface); border-radius: 8px;
    font-family: inherit; font-size: 0.95rem;
    transition: opacity 0.15s;
}
button:hover { opacity: 0.9; }

label { display: block; margin-bottom: 0.375rem; font-weight: 500; color: var(--text-muted); font-size: 0.875rem; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.error { color: var(--red); margin-top: 1rem; font-size: 0.875rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
input[type="checkbox"] { display: inline; width: auto; }

.version-tag {
    text-align: center; padding: 1.5rem 0 1rem;
    color: var(--text-fainter); font-size: 0.75rem; letter-spacing: 0.3px;
}

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

@media (max-width: 500px) {
    main { padding: 0 0.75rem; margin-top: 1.25rem; }
    .tile-grid { grid-template-columns: 1fr; }
    .navbar { padding: 0.75rem 1rem; }
    .nav-title { font-size: 1.1rem; }
}
