:root {
    --bg: #0f1220;
    --bg-soft: #171a2b;
    --surface: #ffffff;
    --surface-2: #f6f7fb;
    --text: #1c2033;
    --text-soft: #5b6178;
    --muted: #8b90a3;
    --border: #e6e8f0;
    --primary: #5b5ef4;
    --primary-600: #4b4ee0;
    --primary-700: #3d40c9;
    --accent: #17c964;
    --danger: #e5484d;
    --warning: #f5a524;
    --info: #0ea5e9;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16,20,45,.06), 0 8px 24px rgba(16,20,45,.08);
    --shadow-lg: 0 12px 48px rgba(16,20,45,.18);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PT Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--surface-2);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; }
p { margin: 0 0 1em; }
img { max-width: 100%; }

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 460px; margin: 0 auto; padding: 0 20px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font: inherit; font-weight: 600;
    padding: 10px 18px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    background: var(--surface-2); color: var(--text);
    transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 16px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.input, .textarea, .select {
    width: 100%; font: inherit;
    padding: 11px 13px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,94,244,.15);
}
.textarea { min-height: 96px; resize: vertical; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-error { background: #fdecee; color: #b42026; border-color: #f6c6c9; }
.alert-success { background: #e7f8ee; color: #0f7a3d; border-color: #bfe9cf; }
.alert-info { background: #e7f3fd; color: #0b5f96; border-color: #c3e0f6; }

/* ---------- Badges / statuses ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-dev      { background: #eef0f5; color: #5b6178; }
.badge-review   { background: #fff3e0; color: #b7791f; }
.badge-rework   { background: #fdecee; color: #b42026; }
.badge-done     { background: #e7f8ee; color: #0f7a3d; }

/* ---------- Public / landing ---------- */
.topbar { background: rgba(15,18,32,.0); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--text); letter-spacing: -.02em; }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #8f79ff); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }

.hero { padding: 72px 0 56px; text-align: center; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); letter-spacing: -.03em; margin-bottom: 18px; }
.hero p.lead { font-size: 19px; color: var(--text-soft); max-width: 640px; margin: 0 auto 30px; }
.hero-cta { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 20px; padding: 20px 0 72px; }
.feature { padding: 24px; }
.feature .ico { width: 44px; height: 44px; border-radius: 11px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.feature h3 { font-size: 17px; }
.feature p { color: var(--text-soft); margin: 0; font-size: 14px; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-pad { padding: 32px; }
.auth-title { text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-soft); margin-bottom: 24px; }
.auth-alt { text-align: center; margin-top: 18px; color: var(--text-soft); font-size: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- App shell (dashboard) ---------- */
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.app-header-inner { display: flex; align-items: center; gap: 20px; padding: 12px 24px; }
.app-nav { display: flex; gap: 4px; margin-left: 12px; }
.app-nav a { padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text-soft); font-weight: 600; font-size: 14px; }
.app-nav a.active, .app-nav a:hover { background: var(--surface-2); color: var(--text); }
.app-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.app-main { padding: 28px 24px; max-width: 1200px; margin: 0 auto; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; }

/* grid of cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 18px; }
.tile { display: block; padding: 20px; transition: box-shadow .15s, transform .05s; }
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.tile h3 { font-size: 17px; margin-bottom: 6px; color: var(--text); }
.tile .meta { color: var(--muted); font-size: 13px; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-soft); }
.empty .ico { font-size: 40px; margin-bottom: 12px; }

table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.tbl tr:hover td { background: var(--surface-2); }

.row-actions { display: flex; gap: 8px; }
.flex { display: flex; }
.gap { gap: 12px; }
.items-center { align-items: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.text-muted { color: var(--muted); }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,18,32,.5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 480px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.close-x { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

@media (max-width: 640px) {
    .app-header-inner { flex-wrap: wrap; }
    .app-nav { order: 3; width: 100%; overflow-x: auto; }
}
