:root {
    --c-bg: #f5f5f5;
    --c-surface: #ffffff;
    --c-border: #dcdcdc;
    --c-text: #1a1a1a;
    --c-muted: #666666;
    --c-accent: #FCD211;
    --c-accent-dark: #c9a300;
    --c-danger: #c0392b;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Source Sans 3", "DejaVu Sans", "Helvetica", "Arial", sans-serif;
    font-size: 14px;
    color: var(--c-text);
    background: var(--c-bg);
}

a { color: #1a4f8a; text-decoration: none; }
a:hover { text-decoration: underline; }

header.app-header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
header.app-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}
header.app-header .header-spacer { flex: 1; }
header.app-header .accent-bar {
    width: 6px;
    height: 28px;
    background: var(--c-accent);
    border-radius: 2px;
}

main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.flash--success { background: #e6f4ea; color: #1e6c2c; border: 1px solid #b4d9c0; }
.flash--error   { background: #fdecea; color: #a03028; border: 1px solid #f4b5b1; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    font: inherit;
    color: var(--c-text);
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #f0f0f0; text-decoration: none; }
.btn--primary {
    background: var(--c-accent);
    border-color: var(--c-accent-dark);
    color: #1a1a1a;
    font-weight: 600;
}
.btn--primary:hover { background: #ffe04a; }
.btn--danger { color: var(--c-danger); border-color: #e9b3ae; }
.btn--danger:hover { background: #fdecea; }
.btn--small { padding: 4px 10px; font-size: 13px; }

/* ===== List ===== */
.list-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.list-toolbar h2 {
    margin: 0;
    font-size: 22px;
}
.list-toolbar .spacer { flex: 1; }

table.cards {
    width: 100%;
    border-collapse: collapse;
    background: var(--c-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
table.cards th,
table.cards td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border);
    vertical-align: middle;
}
table.cards th {
    font-weight: 600;
    font-size: 13px;
    color: var(--c-muted);
    background: #fafafa;
}
table.cards tr:last-child td { border-bottom: none; }
table.cards td.actions {
    text-align: right;
    white-space: nowrap;
}
table.cards td.actions form {
    display: inline;
}
.empty {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    color: var(--c-muted);
    box-shadow: var(--shadow);
}

/* ===== Edit page: form + preview ===== */
.editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: start;
}
@media (max-width: 1100px) {
    .editor { grid-template-columns: 1fr; }
}

.form-card {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.form-card h2 {
    margin: 0 0 16px;
    font-size: 20px;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-muted);
    margin-bottom: 4px;
}
.form-grid input[type="text"],
.form-grid input[type="email"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}
.form-grid input:focus {
    outline: none;
    border-color: var(--c-accent-dark);
    box-shadow: 0 0 0 3px rgba(252, 210, 17, 0.3);
}
.form-grid .field-hint {
    font-size: 12px;
    color: var(--c-muted);
    margin-top: 2px;
}
.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--c-border);
}
.form-actions .spacer { flex: 1; }

/* Preview pane */
.preview-pane {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.preview-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-muted);
    font-weight: 600;
}
.preview-frame {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--c-border);
}

/* ===== Header nav + user widget ===== */
.app-nav {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}
.app-nav__link {
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--c-text);
    font-weight: 500;
    text-decoration: none;
}
.app-nav__link:hover {
    background: #f0f0f0;
    text-decoration: none;
}
.app-nav__link.is-active {
    background: var(--c-accent);
    color: #1a1a1a;
}

.user-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--c-border);
}
.user-widget__label {
    font-size: 13px;
    color: var(--c-muted);
}
.user-widget__form {
    margin: 0;
}

.btn--link {
    background: transparent;
    border: none;
    color: #1a4f8a;
    padding: 4px 6px;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}
.btn--link:hover {
    text-decoration: underline;
    background: transparent;
}

/* ===== Order bar (editor toolbar on cards index) ===== */
.order-bar {
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}
.order-bar__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 260px;
}
.order-bar .field-hint {
    padding-bottom: 8px;
}
.order-bar__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.order-bar__input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}
.order-bar__input:focus {
    outline: none;
    border-color: var(--c-accent-dark);
    box-shadow: 0 0 0 3px rgba(252, 210, 17, 0.3);
}

/* ===== Login page ===== */
body.login-page {
    background: var(--c-bg);
    min-height: 100vh;
}
.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.login-card {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}
.login-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--c-accent);
    border-radius: var(--radius) var(--radius) 0 0;
}
.login-card h1 {
    margin: 8px 0 0;
    font-size: 22px;
}
.login-subtitle {
    margin: 0;
    color: var(--c-muted);
    font-size: 14px;
}
.login-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.login-field span {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-muted);
}
.login-field input {
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}
.login-field input:focus {
    outline: none;
    border-color: var(--c-accent-dark);
    box-shadow: 0 0 0 3px rgba(252, 210, 17, 0.3);
}
.login-submit {
    margin-top: 8px;
    width: 100%;
}
