:root {
    color-scheme: light;
    --bg: #ebe2d4;
    --bg-deep: #ddd1bf;
    --panel: rgba(255, 252, 247, 0.96);
    --panel-soft: rgba(249, 244, 237, 0.94);
    --ink: #241e18;
    --muted: #6f675e;
    --line: rgba(36, 30, 24, 0.1);
    --line-strong: rgba(36, 30, 24, 0.16);
    --accent: #8a5c3b;
    --accent-strong: #6d4428;
    --accent-soft: rgba(138, 92, 59, 0.12);
    --olive: #687152;
    --shadow-xl: 0 28px 58px rgba(76, 58, 41, 0.14);
    --shadow-lg: 0 18px 34px rgba(76, 58, 41, 0.1);
    --shadow-sm: 0 10px 18px rgba(76, 58, 41, 0.08);
    --radius-2xl: 34px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.84), transparent 20%),
        radial-gradient(circle at 86% 16%, rgba(138, 92, 59, 0.08), transparent 18%),
        linear-gradient(180deg, #f6f0e7 0%, var(--bg) 42%, var(--bg-deep) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 28%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 86px);
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.3), transparent 82%);
}

.hidden {
    display: none !important;
}

.shell {
    width: min(1480px, calc(100% - 40px));
    margin: 30px auto 52px;
    position: relative;
    z-index: 1;
}

.eyebrow,
.card-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(111, 103, 94, 0.84);
}

.eyebrow::before {
    content: "";
    width: 18px;
    height: 1px;
    background: currentColor;
    opacity: 0.7;
}

.docket-cover,
.rule-card,
.draft-panel,
.record-card,
.status-card,
.sidebar-card,
.notice {
    border: 1px solid var(--line);
    border-radius: var(--radius-2xl);
    background: var(--panel);
    box-shadow: var(--shadow-xl);
}

.docket-cover {
    display: grid;
    gap: 18px;
    padding: 32px;
    margin-bottom: 24px;
    background:
        linear-gradient(180deg, rgba(255, 252, 247, 0.98) 0%, rgba(248, 243, 236, 0.96) 100%);
}

.cover-copy h1,
.rule-card h2,
.panel-head h2,
.status-card strong,
.sidebar-card strong {
    margin: 0;
    letter-spacing: -0.05em;
}

.cover-copy h1 {
    font-size: 30px;
    line-height: 1;
}

.lead,
.rule-card p,
.rule-list,
.panel-copy,
.form-note,
.status-card p,
.sidebar-card p,
.notice,
.muted {
    margin: 0;
    color: var(--muted);
    line-height: 1.72;
}

.lead {
    max-width: 68ch;
    font-size: 1.03rem;
}

.cover-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cover-tags span {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(138, 92, 59, 0.14);
    background: rgba(138, 92, 59, 0.06);
    color: #65452e;
    font-size: 0.89rem;
    font-weight: 800;
}

.filing-grid {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 340px;
    gap: 22px;
    align-items: start;
}

.rules-side,
.draft-side,
.status-side {
    display: grid;
    gap: 18px;
}

.rule-card,
.draft-panel,
.record-card,
.status-card,
.sidebar-card {
    padding: 24px;
}

.rule-card {
    background:
        linear-gradient(180deg, rgba(255, 252, 247, 0.98) 0%, rgba(246, 240, 232, 0.95) 100%);
}

.rule-card-accent {
    background:
        linear-gradient(180deg, rgba(138, 92, 59, 0.12) 0%, rgba(255, 249, 242, 0.96) 100%);
}

.rule-card h2 {
    font-size: 1.56rem;
    line-height: 1.08;
    margin-bottom: 12px;
}

.rule-list {
    display: grid;
    gap: 10px;
    padding-left: 18px;
}

.draft-panel {
    background:
        linear-gradient(180deg, rgba(255, 253, 249, 0.98) 0%, rgba(247, 242, 235, 0.96) 100%);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 20px;
}

.panel-head.compact {
    margin-bottom: 16px;
}

.panel-head h2 {
    font-size: 1.62rem;
    line-height: 1.04;
}

.head-actions {
    display: flex;
    justify-content: flex-end;
}

.tool-form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 10px;
}

.field > span {
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(36, 30, 24, 0.82);
}

textarea {
    width: 100%;
    min-height: 360px;
    resize: vertical;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    padding: 18px 20px;
    font: inherit;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.88);
    transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
}

textarea::placeholder {
    color: rgba(111, 103, 94, 0.7);
}

textarea:focus {
    outline: none;
    border-color: rgba(138, 92, 59, 0.36);
    box-shadow: 0 0 0 4px rgba(138, 92, 59, 0.08);
    transform: translateY(-1px);
}

.draft-actions {
    display: grid;
    gap: 14px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

button {
    min-height: 52px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease), opacity 180ms var(--ease);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button[type="submit"] {
    color: #fff9f3;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    box-shadow: 0 14px 28px rgba(109, 68, 40, 0.18);
}

.ghost-button {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
}

.record-row {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 18px;
}

.record-card {
    background:
        linear-gradient(180deg, rgba(255, 252, 247, 0.98) 0%, rgba(244, 239, 232, 0.96) 100%);
}

.preview-box {
    min-height: 320px;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.74);
    display: grid;
    align-content: start;
    gap: 16px;
}

.preview-box p {
    margin: 0;
}

.preview-box strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1rem;
}

.code-block {
    margin: 0;
    min-height: 320px;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.74);
    color: #3a332c;
    font: 500 0.95rem/1.68 "SFMono-Regular", "SF Mono", "Menlo", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.status-card {
    background:
        linear-gradient(180deg, rgba(255, 252, 247, 0.98) 0%, rgba(245, 239, 231, 0.96) 100%);
}

.status-card strong {
    display: block;
    font-size: 1.5rem;
    line-height: 1.08;
    margin-bottom: 8px;
}

.status-card-muted {
    background:
        linear-gradient(180deg, rgba(104, 113, 82, 0.1) 0%, rgba(255, 249, 241, 0.96) 100%);
}

.notice {
    padding: 16px 18px;
}

.sidebar-card {
    background:
        linear-gradient(180deg, rgba(255, 251, 246, 0.98) 0%, rgba(245, 239, 231, 0.96) 100%);
}

.sidebar-card .sidebar-title {
    font-size: 1.38rem;
    letter-spacing: -0.04em;
}

.sidebar-card .sidebar-copy,
.sidebar-card .sidebar-placeholder-note {
    color: var(--muted);
}

.sidebar-card .sidebar-ad-slot,
.sidebar-card .sidebar-ad-placeholder {
    min-height: 320px;
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.76);
}

.sidebar-card .sidebar-ad-placeholder {
    padding: 14px;
}

.sidebar-card .sidebar-ad-mock {
    min-height: 288px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background:
        radial-gradient(circle at center, rgba(138, 92, 59, 0.08), transparent 44%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(246, 240, 232, 0.86) 100%);
}

.sidebar-card .sidebar-ad-badge {
    width: 158px;
    height: 158px;
    border-radius: 999px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 2px;
    color: #fff7ef;
    background: linear-gradient(180deg, rgba(138, 92, 59, 0.98) 0%, rgba(109, 68, 40, 0.94) 100%);
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

@media (max-width: 1260px) {
    .filing-grid,
    .record-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 20px, 100%);
        margin: 18px auto 28px;
    }

    .docket-cover,
    .rule-card,
    .draft-panel,
    .record-card,
    .status-card,
    .sidebar-card {
        padding: 20px;
    }

    textarea,
    .preview-box,
    .code-block {
        min-height: 240px;
    }

    .panel-head,
    .head-actions,
    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

    button,
    .ghost-button {
        width: 100%;
    }
}
