:root {
    --ink: #111827;
    --ink-soft: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --page: #f4f7fb;
    --brand: #16325c;
    --brand-deep: #0b1f3a;
    --accent: #1677ff;
    --accent-soft: #eaf3ff;
    --shadow-sm: 0 8px 22px rgba(15,23,42,.06);
    --shadow-md: 0 22px 58px rgba(15,23,42,.12);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--page);
}
button, input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.owner-shell {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 24px 0 46px;
}
.login-card {
    width: min(420px, 100%);
    max-width: 100%;
    margin: 12vh auto 0;
    display: grid;
    gap: 18px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-md);
}
.login-card, .login-card * { min-width: 0; }
.login-card p { overflow-wrap: anywhere; }
.owner-logo {
    width: 84px;
    height: 52px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--brand-deep);
}
.owner-logo img { width: 100%; height: 100%; object-fit: cover; }
.kicker {
    margin: 0 0 6px;
    color: var(--accent) !important;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; line-height: 1.2; }
h2 { margin: 0; font-size: 17px; line-height: 1.25; }
p, .hint, .panel-header span { color: var(--muted); line-height: 1.6; }
.login-card p { margin: 7px 0 0; font-size: 13px; }

form { display: grid; gap: 12px; }
label {
    display: grid;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
}
input, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
input { min-height: 43px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(22,119,255,.1);
}
button, .panel-header a {
    min-height: 42px;
    border: 1px solid var(--brand);
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    transition: transform .18s ease, box-shadow .18s ease;
}
button:hover, .panel-header a:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.panel {
    display: grid;
    gap: 18px;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.panel-header span { display: block; margin-top: 6px; font-size: 12px; }
.panel-header a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    font-size: 12px;
}
.settings-form { display: grid; gap: 14px; }
.settings-form article {
    min-width: 0;
    display: grid;
    gap: 12px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.article-heading {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--line);
}
.article-heading > span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
}
.article-heading p { margin: 4px 0 0; font-size: 11px; }
.hint { margin: 0; font-size: 11px; }
.grid-2 { display: grid; gap: 10px; }
.upload-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}
.upload-row button, .brand-logo-row button { padding: 0 12px; font-size: 12px; }
.preview-list { display: grid; gap: 8px; }
.preview-item {
    min-height: 56px;
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
}
.preview-item img {
    width: 78px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--brand-deep);
}
.logo-preview { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.logo-preview .preview-item { grid-template-columns: 40px minmax(0, 1fr); }
.logo-preview img { width: 40px; height: 40px; object-fit: contain; background: #fff; }
.brand-logo-list {
    display: grid;
    gap: 8px;
    max-height: 560px;
    overflow: auto;
    padding-right: 3px;
}
.brand-logo-row {
    min-width: 0;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) minmax(130px, .75fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
}
.brand-logo-row strong, .brand-logo-row small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.brand-logo-row strong { font-size: 12px; }
.brand-logo-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.brand-logo-thumb {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.brand-logo-thumb img { width: 100%; height: 100%; object-fit: contain; }
.advanced-field { margin-top: 2px; }
.advanced-field summary { cursor: pointer; color: var(--brand); font-size: 12px; font-weight: 800; }
.advanced-field textarea { margin-top: 10px; }
.empty-upload {
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 12px;
}
.save-button {
    position: sticky;
    bottom: 14px;
    z-index: 10;
    min-height: 48px;
    box-shadow: 0 12px 28px rgba(22,50,92,.22);
}
.toast {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 50;
    display: none;
    padding: 13px 14px;
    border-radius: var(--radius);
    background: var(--brand-deep);
    color: #fff;
    box-shadow: var(--shadow-md);
    font-size: 12px;
    font-weight: 750;
}
.toast.show { display: block; animation: toastIn .2s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 680px) {
    .panel-header { align-items: flex-start; flex-direction: column; }
    .upload-row, .brand-logo-row { grid-template-columns: 1fr; }
    .brand-logo-thumb { width: 48px; height: 48px; }
}
@media (min-width: 720px) {
    .owner-shell { width: min(1180px, calc(100% - 48px)); padding-top: 30px; }
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .toast { left: auto; right: 24px; bottom: 24px; width: min(380px, calc(100% - 48px)); }
}
@media (min-width: 980px) {
    .settings-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .settings-form article:nth-of-type(4) { grid-column: 1 / -1; }
    .save-button { grid-column: 1 / -1; }
}
