/* Memory Films CRM - design system (mobile first).
   Brand colours live in the variables below. When the Memory Films logo and
   colours arrive, only this block needs to change. */
:root {
    --accent: #3D4ED8;
    --accent-dark: #2F3DB0;
    --ink: #15171C;
    --muted: #5B6170;
    --ground: #F4F5F7;
    --card: #FFFFFF;
    --line: #E6E8EC;
    --line-strong: #D5D9E0;
    --good-bg: #DCFCE7;   --good-ink: #166534;
    --warn-bg: #FEF3C7;   --warn-ink: #92400E;
    --bad-bg: #FEF2F2;    --bad-ink: #991B1B;   --bad-line: #FECACA;
    --info-bg: #DBEAFE;   --info-ink: #1E40AF;
    --radius: 16px;
    --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --font-head: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
img { max-width: 100%; }

.h1 { font-family: var(--font-head); font-weight: 700; font-size: 22px; line-height: 1.25; }
.h2 { font-family: var(--font-head); font-weight: 700; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.break { overflow-wrap: anywhere; }

/* Top bar and navigation */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #FFFFFF;
    display: flex; align-items: center; justify-content: center; flex: none;
    font-family: var(--font-head); font-weight: 800; font-size: 15px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); }
.topbar-user { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mainnav {
    display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--card);
    border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.mainnav a, .mainnav .linklike {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 10px;
    font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.mainnav a.is-active { color: var(--accent); font-weight: 600; background: #EEF0FD; }
.nav-logout { margin: 0 0 0 auto; }
.linklike { background: none; border: none; font-family: inherit; cursor: pointer; }
.mainnav .linklike { color: var(--bad-ink); font-weight: 600; }

.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 16px; }
.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 0 16px 24px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.card-dark { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.card-dark .muted { color: #C9CDD6; }
.card > .stack, .card.stack { gap: 14px; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px;
    font-size: 11px; font-weight: 600; line-height: 1.4; white-space: nowrap;
    background: #EEF0F3; color: var(--ink);
}
.badge-role { background: var(--ink); color: #FFFFFF; }
.badge-good { background: var(--good-bg); color: var(--good-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-bad  { background: var(--bad-bg);  color: var(--bad-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }

/* Alerts */
.alert { border-radius: 14px; padding: 12px 14px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--good-bg); color: var(--good-ink); }
.alert-error   { background: var(--bad-bg);  color: var(--bad-ink); border-color: var(--bad-line); }
.alert-info    { background: var(--info-bg); color: var(--info-ink); }
.alert-warn    { background: var(--warn-bg); color: var(--warn-ink); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); }
.input, .select {
    width: 100%; min-height: 48px; border-radius: 14px; border: 1px solid var(--line-strong);
    background: #FFFFFF; padding: 10px 14px; font-family: inherit; font-size: 16px; color: var(--ink);
}
.input:focus, .select:focus, .btn:focus-visible, .linklike:focus-visible, a:focus-visible {
    outline: 3px solid rgba(61, 78, 216, 0.35); outline-offset: 2px;
}
.input-group { position: relative; }
.input-group .input { padding-right: 76px; }
.input-toggle {
    position: absolute; right: 6px; top: 6px; height: 36px; padding: 0 10px; border-radius: 10px;
    border: none; background: #EEF0F3; color: var(--ink); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
    font-family: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: #FFFFFF; color: var(--ink); border-color: var(--line-strong); }
.btn-danger { background: #FFFFFF; color: var(--bad-ink); border-color: var(--bad-line); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }

/* Login and other single-card screens */
.auth-body { background: var(--ink); }
.auth-wrap {
    min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 18px; padding: 24px 16px;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #FFFFFF; text-align: center; }
.auth-brand .brand-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 20px; }
.auth-brand .brand-name { font-size: 22px; }
.auth-brand .brand-sub { color: #C9CDD6; font-size: 13px; }
.auth-card { width: 100%; max-width: 420px; padding: 22px 18px; display: flex; flex-direction: column; gap: 16px; }
.auth-note { color: #C9CDD6; font-size: 12px; text-align: center; max-width: 420px; }
.error-code { font-family: var(--font-head); font-weight: 800; font-size: 40px; color: var(--accent); line-height: 1; }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: none; padding-top: 0; }
.list-item:last-child { padding-bottom: 0; }
.list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-title { font-weight: 600; font-size: 14px; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

.user-card { display: flex; flex-direction: column; gap: 12px; }
.user-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
details.more { border-top: 1px solid var(--line); padding-top: 10px; }
details.more > summary {
    cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent);
    min-height: 44px; display: flex; align-items: center; list-style: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 10px; }

.code {
    display: block; background: #0F1115; color: #E6E8EC; border-radius: 12px; padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
    overflow-wrap: anywhere; white-space: pre-wrap;
}

@media (min-width: 640px) {
    .page { padding: 28px 24px 40px; }
    .topbar { padding: 14px 24px; }
    .mainnav { padding: 6px 18px; }
    .topbar-user { flex-direction: row; align-items: center; gap: 10px; }
    .user-name { max-width: 240px; }
    .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
    .user-actions { grid-template-columns: 1fr 1fr; }
    .card { padding: 20px; }
}
