/* Shared Exodile design tokens and primitives.
   Layout-specific rules belong in admin-platform.css or engine-console.css. */
:root {
    --l4d-sidebar-width: 280px;
    --l4d-header-height: 80px;

    --l4d-bg: #f8f6ef;
    --l4d-bg-alt: #e9e3d5;
    --l4d-surface: #fffdf7;
    --l4d-surface-soft: #f7f2e8;
    --l4d-surface-muted: #e9e3d5;

    --l4d-primary: #18322b;
    --l4d-primary-alt: #0d211b;
    --l4d-secondary: #bd8d3d;
    --l4d-secondary-alt: #9c702d;
    --l4d-highlight: #dcebe2;

    --l4d-border: #d8d0bf;
    --l4d-border-subtle: rgba(24, 50, 43, 0.12);
    --l4d-border-strong: #b9aa8e;

    --l4d-ink: #18322b;
    --l4d-ink-muted: #68766e;
    --l4d-ink-subtle: #8b978f;
    --l4d-ink-inverse: #fffdf7;
    --l4d-ink-inverse-muted: rgba(255, 253, 247, 0.72);

    --l4d-success: #2f7d46;
    --l4d-warning: #b87918;
    --l4d-failed: #a33a35;
    --l4d-danger: var(--l4d-failed);
    --l4d-info: #286f89;

    --l4d-radius: 10px;
    --l4d-radius-lg: 16px;
    --l4d-shadow: 0 1px 3px rgba(24, 50, 43, 0.07), 0 1px 2px rgba(24, 50, 43, 0.04);
    --l4d-shadow-strong: 0 10px 20px rgba(24, 50, 43, 0.10), 0 4px 8px rgba(24, 50, 43, 0.06);
    --l4d-shadow-hover: 0 12px 28px rgba(24, 50, 43, 0.12);
    --l4d-shadow-rail: 4px 0 30px rgba(13, 33, 27, 0.24);
    --l4d-shadow-modal: 0 30px 70px rgba(13, 33, 27, 0.30);
    --l4d-focus-ring: 0 0 0 3px rgba(189, 141, 61, 0.24);
    --l4d-overlay: rgba(13, 33, 27, 0.62);

    --l4d-control-height: 3rem;
    --l4d-control-radius: 0.75rem;
    --l4d-control-padding-x: 0.875rem;
    --l4d-control-bg: var(--l4d-surface);
    --l4d-control-bg-muted: var(--l4d-surface-muted);
    --l4d-control-border: var(--l4d-border);
    --l4d-control-border-hover: var(--l4d-border-strong);
    --l4d-control-text: var(--l4d-ink);
    --l4d-control-placeholder: var(--l4d-ink-subtle);
    --l4d-control-accent: var(--l4d-secondary);
    --l4d-control-accent-hover: var(--l4d-secondary-alt);
    --l4d-control-accent-contrast: var(--l4d-ink-inverse);
    --l4d-control-shadow: 0 1px 2px var(--l4d-border-subtle);
    --l4d-checkbox-size: 1.125rem;
    --l4d-file-button-bg: var(--l4d-primary);
    --l4d-file-button-bg-hover: var(--l4d-primary-alt);
    --l4d-file-button-text: var(--l4d-ink-inverse);
    --l4d-file-drop-bg: var(--l4d-surface-soft);
    --l4d-file-drop-border: var(--l4d-border);
    --l4d-toolbar-radius: 1rem;
    --l4d-toolbar-control-radius: 0.875rem;
    --l4d-toolbar-control-gap: 0.625rem;

    --l4d-shell-border: rgba(255, 255, 255, 0.10);
    --l4d-shell-surface: rgba(255, 255, 255, 0.05);
    --l4d-shell-hover: rgba(255, 253, 247, 0.10);
    --l4d-shell-active: rgba(189, 141, 61, 0.30);
    --l4d-shell-active-border: rgba(255, 255, 255, 0.18);

    --site-font-ui: "Inter", system-ui, -apple-system, sans-serif;
    --site-font-heading: "Inter", system-ui, -apple-system, sans-serif;
    --site-font-body: "Inter", system-ui, -apple-system, sans-serif;

    --l4d-pill-neutral-bg: #e9e3d5;
    --l4d-pill-neutral-text: #536159;
    --l4d-pill-neutral-border: rgba(83, 97, 89, 0.2);
    --l4d-pill-muted-bg: #f7f2e8;
    --l4d-pill-muted-text: #4b5d53;
    --l4d-pill-muted-border: rgba(75, 93, 83, 0.2);
    --l4d-pill-info-bg: #edf5f1;
    --l4d-pill-info-text: #286f89;
    --l4d-pill-info-border: rgba(40, 111, 137, 0.2);
    --l4d-pill-accent-bg: #f4ead7;
    --l4d-pill-accent-text: #7a5924;
    --l4d-pill-accent-border: rgba(122, 89, 36, 0.2);
    --l4d-pill-success-bg: #edf5ef;
    --l4d-pill-success-text: #2f7d46;
    --l4d-pill-success-border: rgba(47, 125, 70, 0.2);
    --l4d-pill-warning-bg: #fbf2df;
    --l4d-pill-warning-text: #9c6514;
    --l4d-pill-warning-border: rgba(156, 101, 20, 0.2);
    --l4d-pill-danger-bg: #f8e9e7;
    --l4d-pill-danger-text: #a33a35;
    --l4d-pill-danger-border: rgba(163, 58, 53, 0.2);

    --surface: var(--l4d-surface);
    --muted: var(--l4d-ink-muted);
    --border-strong: var(--l4d-border);
    --l4d-muted: var(--l4d-ink-muted);
    --l4d-admin-border: var(--l4d-border);
    --l4d-admin-brown: var(--l4d-primary);
    --l4d-admin-brown-soft: var(--l4d-ink-muted);
    --l4d-admin-cream: var(--l4d-surface-soft);
}

.l4d-ui-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--l4d-secondary);
    border-radius: var(--l4d-control-radius);
    background: var(--l4d-secondary);
    color: var(--l4d-ink-inverse);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.l4d-ui-button:hover { border-color: var(--l4d-secondary-alt); background: var(--l4d-secondary-alt); }
.l4d-ui-button--secondary { border-color: var(--l4d-border); background: var(--l4d-surface); color: var(--l4d-ink); }
.l4d-ui-button--secondary:hover { border-color: var(--l4d-primary); background: var(--l4d-surface-soft); }
.l4d-ui-button--quiet { border-color: transparent; background: transparent; color: var(--l4d-ink-muted); }
.l4d-ui-button--quiet:hover { border-color: var(--l4d-border); background: var(--l4d-surface-soft); color: var(--l4d-ink); }

.l4d-ui-field { display: grid; gap: 7px; }
.l4d-ui-field > span { color: var(--l4d-ink-muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.l4d-ui-field input,
.l4d-ui-field select {
    width: 100%;
    min-height: var(--l4d-control-height);
    padding: 10px var(--l4d-control-padding-x);
    border: 1px solid var(--l4d-control-border);
    border-radius: var(--l4d-control-radius);
    outline: none;
    background: var(--l4d-control-bg);
    color: var(--l4d-control-text);
    box-shadow: var(--l4d-control-shadow);
    font: inherit;
}
.l4d-ui-field input::placeholder { color: var(--l4d-control-placeholder); }
.l4d-ui-field input:hover,
.l4d-ui-field select:hover { border-color: var(--l4d-control-border-hover); }
.l4d-ui-field input:focus,
.l4d-ui-field select:focus { border-color: var(--l4d-control-accent); box-shadow: var(--l4d-focus-ring); }

.l4d-ui-modal[hidden] { display: none; }
.l4d-ui-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
}
.l4d-ui-modal__backdrop { position: absolute; inset: 0; border: 0; background: var(--l4d-overlay); backdrop-filter: blur(4px); cursor: default; }
.l4d-ui-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(760px, 100%);
    max-height: min(88dvh, 860px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--l4d-border);
    border-radius: var(--l4d-radius-lg);
    background: var(--l4d-surface);
    box-shadow: var(--l4d-shadow-modal);
}
.l4d-ui-modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--l4d-border); }
.l4d-ui-modal__header h2 { margin: 4px 0 0; color: var(--l4d-ink); font-size: 24px; }
.l4d-ui-modal__close { width: 40px; min-height: 40px; padding: 0; border: 1px solid var(--l4d-border); border-radius: 50%; background: var(--l4d-surface); color: var(--l4d-ink); font: inherit; font-size: 22px; cursor: pointer; }
.l4d-ui-modal__body { min-height: 0; overflow: auto; padding: 24px; }
.l4d-ui-modal__footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--l4d-border); background: var(--l4d-surface-soft); }
.l4d-modal-open { overflow: hidden; }

@media (max-width: 620px) {
    .l4d-ui-modal { align-items: end; padding: 0; }
    .l4d-ui-modal__dialog { width: 100%; max-height: 96dvh; border-radius: 18px 18px 0 0; }
    .l4d-ui-modal__header, .l4d-ui-modal__body { padding: 20px; }
    .l4d-ui-modal__footer { align-items: stretch; flex-direction: column-reverse; padding: 14px 20px 20px; }
    .l4d-ui-modal__footer .l4d-ui-button { width: 100%; }
}
