@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --ink: #18201c;
    --muted: #68726b;
    --paper: #f3f0e7;
    --card: rgba(255, 255, 252, 0.88);
    --line: rgba(24, 32, 28, 0.13);
    --lime: #b7f34a;
    --orange: #ff7b45;
    --blue: #5277ff;
    --teal: #36c9a3;
    --rose: #f0617d;
    --gold: #e6b936;
    --danger: #bd3f3f;
    --shadow: 0 24px 60px rgba(33, 39, 33, 0.09);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(183, 243, 74, 0.22), transparent 24rem),
        radial-gradient(circle at 92% 90%, rgba(82, 119, 255, 0.13), transparent 28rem),
        var(--paper);
    font-family: 'Manrope', sans-serif;
}

button, input, textarea { font: inherit; }
a { color: inherit; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, .9fr) minmax(440px, 1.1fr);
}

.auth-art {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 5rem);
    color: #f8f7ef;
    background: #15231d;
}

.auth-art::before,
.auth-art::after {
    content: '';
    position: absolute;
    border-radius: 999px;
}

.auth-art::before {
    width: 34rem;
    height: 34rem;
    right: -16rem;
    bottom: -10rem;
    border: 7rem solid var(--lime);
    opacity: .9;
}

.auth-art::after {
    width: 15rem;
    height: 15rem;
    top: 18%;
    left: 15%;
    background: var(--orange);
    filter: blur(1px);
    opacity: .92;
    transform: rotate(18deg);
    border-radius: 2.2rem;
}

.brand {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    font-weight: 800;
    letter-spacing: -.04em;
    font-size: 1.2rem;
}

.brand-mark {
    width: 2.3rem;
    height: 2.3rem;
    display: grid;
    place-items: center;
    border-radius: .75rem;
    color: #15231d;
    background: var(--lime);
    font-family: 'IBM Plex Mono', monospace;
}

.auth-copy {
    position: absolute;
    z-index: 2;
    left: clamp(2rem, 5vw, 5rem);
    right: clamp(2rem, 5vw, 5rem);
    bottom: clamp(2.5rem, 7vw, 6rem);
}

.eyebrow {
    margin: 0 0 1rem;
    color: var(--lime);
    font-family: 'IBM Plex Mono', monospace;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.auth-copy h1 {
    max-width: 13ch;
    margin: 0;
    font-size: clamp(2.6rem, 5vw, 5.8rem);
    line-height: .96;
    letter-spacing: -.075em;
}

.auth-copy p {
    max-width: 35rem;
    margin: 1.5rem 0 0;
    color: rgba(255,255,255,.68);
    line-height: 1.7;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.auth-card { width: min(100%, 29rem); }
.auth-card h2 { margin: 0; font-size: 2rem; letter-spacing: -.05em; }
.auth-card > p { margin: .65rem 0 2rem; color: var(--muted); line-height: 1.6; }

.field { display: grid; gap: .55rem; margin-bottom: 1rem; }
.field label { font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.field input, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: .95rem 1rem;
    color: var(--ink);
    background: rgba(255,255,255,.75);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.field textarea { min-height: 6.5rem; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: #4c695a; box-shadow: 0 0 0 4px rgba(76,105,90,.11); }
.field input[readonly] { color: #3d4942; background: rgba(24,32,28,.045); }
.hint { color: var(--muted); font-size: .8rem; line-height: 1.5; }

.primary-btn, .ghost-btn, .preset-btn {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform .16s, opacity .16s, background .16s;
}

.primary-btn {
    width: 100%;
    padding: 1rem 1.2rem;
    color: #122018;
    background: var(--lime);
    font-weight: 800;
    box-shadow: 0 10px 26px rgba(98, 145, 29, .18);
}

.primary-btn:hover, .ghost-btn:hover, .preset-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled { cursor: wait; opacity: .55; transform: none; }

.alert {
    margin-bottom: 1.1rem;
    padding: .9rem 1rem;
    border-radius: .9rem;
    font-size: .88rem;
    line-height: 1.5;
}

.alert-error { color: #7e2929; background: #f8dddd; border: 1px solid #efbcbc; }
.alert-success { color: #255f40; background: #def3e6; border: 1px solid #bee4cd; }

.otp-code { letter-spacing: .48em; text-align: center; font-family: 'IBM Plex Mono', monospace; font-size: 1.35rem; }
.back-link { display: inline-block; margin-top: 1.25rem; color: var(--muted); font-size: .88rem; text-decoration: none; }

.app-shell { width: min(1480px, calc(100% - 2rem)); margin: 0 auto; padding-bottom: 4rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 0; }
.topbar .brand { color: var(--ink); }
.topbar .brand-mark { background: var(--ink); color: var(--lime); }
.top-actions { display: flex; align-items: center; gap: .8rem; }
.identity { color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: .78rem; }
.ghost-btn { padding: .7rem 1rem; color: var(--ink); background: rgba(255,255,255,.68); border: 1px solid var(--line); font-size: .82rem; font-weight: 700; }

.hero {
    position: relative;
    overflow: hidden;
    min-height: 15rem;
    padding: clamp(2rem, 5vw, 4.5rem);
    border-radius: 2rem;
    color: #f8f7ef;
    background: #18241e;
    box-shadow: var(--shadow);
}

.hero::after {
    content: '';
    position: absolute;
    width: 30rem;
    height: 30rem;
    right: -7rem;
    top: -13rem;
    border: 5rem solid var(--lime);
    border-radius: 50%;
    opacity: .93;
}

.hero h1 { position: relative; z-index: 1; max-width: 13ch; margin: 0; font-size: clamp(2.2rem, 5vw, 5rem); line-height: .96; letter-spacing: -.07em; }
.hero p { position: relative; z-index: 1; max-width: 42rem; margin: 1.25rem 0 0; color: rgba(255,255,255,.65); line-height: 1.65; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.25rem; margin-top: 1.25rem; }
.panel { border: 1px solid var(--line); border-radius: 1.5rem; background: var(--card); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.builder { padding: 1.25rem; }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.section-title h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.035em; }
.section-title p { margin: 0; color: var(--muted); font-size: .82rem; }

.tabs { display: flex; gap: .55rem; overflow-x: auto; padding: .1rem 0 .7rem; scrollbar-width: thin; }
.tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .72rem .9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 700;
}

.tab-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); }
.tab.active { color: #fff; border-color: var(--ink); background: var(--ink); }
.form-card { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(15rem, .65fr); gap: 1rem; margin-top: .65rem; padding: 1.35rem; border-radius: 1.25rem; background: rgba(255,255,255,.62); }
.report-intro { margin-bottom: 1.25rem; }
.report-intro h3 { margin: 0; font-size: 1.8rem; letter-spacing: -.05em; }
.report-intro p { margin: .45rem 0 0; color: var(--muted); }
.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.presets { display: flex; flex-wrap: wrap; gap: .45rem; margin: .15rem 0 1.1rem; }
.preset-btn { padding: .52rem .75rem; color: var(--muted); background: #eeece3; font-size: .75rem; font-weight: 700; }
.firm-field[hidden] { display: none; }
.submit-row { display: flex; align-items: center; gap: 1rem; }
.submit-row .primary-btn { width: auto; min-width: 13rem; }
.form-message { color: var(--muted); font-size: .82rem; }
.form-message.error { color: var(--danger); }
.form-message.success { color: #26704a; }

.delivery-card { padding: 1.3rem; color: #eef5f0; background: #27372e; border-radius: 1.2rem; }
.delivery-card .mono { color: var(--lime); font-family: 'IBM Plex Mono', monospace; font-size: .77rem; }
.delivery-card h4 { margin: 1rem 0 .5rem; font-size: 1.15rem; }
.delivery-card p { margin: 0 0 1.1rem; color: rgba(255,255,255,.62); font-size: .83rem; line-height: 1.55; }
.delivery-line { display: flex; gap: .65rem; padding: .8rem 0; border-top: 1px solid rgba(255,255,255,.12); font-size: .8rem; line-height: 1.4; }
.delivery-number { color: var(--lime); font-family: 'IBM Plex Mono', monospace; }

.queue-panel { padding: 1.25rem; margin-top: 1.25rem; }
.queue-list { display: grid; gap: .7rem; }
.job-card { display: grid; grid-template-columns: 2.1fr 1.15fr 1fr auto; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 1.05rem; background: rgba(255,255,255,.62); }
.job-main { min-width: 0; }
.job-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-meta { margin-top: .25rem; color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: .72rem; }
.status-pill { display: inline-flex; align-items: center; gap: .45rem; width: fit-content; padding: .42rem .65rem; border-radius: 999px; background: #ebece6; font-size: .72rem; font-weight: 800; }
.status-pill::before { content: ''; width: .48rem; height: .48rem; border-radius: 50%; background: #9a9e98; }
.status-1::before, .status-4::before { background: var(--gold); }
.status-2::before { background: var(--blue); box-shadow: 0 0 0 .25rem rgba(82,119,255,.12); animation: pulse 1.8s infinite; }
.status-3::before { background: #32a267; }
.progress-wrap { min-width: 8rem; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: .35rem; color: var(--muted); font-size: .7rem; }
.progress { height: .42rem; overflow: hidden; border-radius: 999px; background: #e3e4dd; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--ink); transition: width .4s ease; }
.job-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.report-link { padding: .55rem .72rem; border-radius: .75rem; text-decoration: none; white-space: nowrap; font-size: .73rem; font-weight: 800; }
.sheet-link { background: var(--lime); }
.download-link { color: #fff; background: var(--ink); }
.queue-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.queue-pagination[hidden] { display: none; }
.page-summary { color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: .74rem; }
.page-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.page-btn { min-width: 2.15rem; height: 2.15rem; padding: 0 .65rem; border: 1px solid var(--line); border-radius: .7rem; color: var(--ink); background: rgba(255,255,255,.72); cursor: pointer; font-size: .74rem; font-weight: 800; }
.page-btn.active { color: var(--lime); border-color: var(--ink); background: var(--ink); }
.page-btn:disabled { cursor: default; opacity: .38; }
.empty { padding: 2.5rem 1rem; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 1rem; }

.side-stack { display: grid; align-content: start; gap: 1rem; }
.info-card { padding: 1.25rem; }
.info-card h3 { margin: 0 0 .7rem; font-size: 1rem; }
.info-card p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.65; }
.system-state { display: flex; align-items: center; gap: .55rem; margin-top: 1rem; font-size: .78rem; font-weight: 800; }
.system-state::before { content: ''; width: .55rem; height: .55rem; border-radius: 50%; background: #35a96a; box-shadow: 0 0 0 .28rem rgba(53,169,106,.12); }

@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 980px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-art { min-height: 19rem; }
    .auth-art::after { width: 9rem; height: 9rem; top: 22%; }
    .auth-copy h1 { font-size: 3rem; }
    .workspace { grid-template-columns: 1fr; }
    .side-stack { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .app-shell { width: min(100% - 1rem, 1480px); }
    .topbar { align-items: flex-start; }
    .identity { display: none; }
    .hero { min-height: 13rem; padding: 1.7rem; border-radius: 1.35rem; }
    .hero::after { width: 17rem; height: 17rem; right: -9rem; top: -8rem; border-width: 3rem; }
    .form-card { grid-template-columns: 1fr; padding: 1rem; }
    .date-grid { grid-template-columns: 1fr; }
    .submit-row { align-items: stretch; flex-direction: column; }
    .submit-row .primary-btn { width: 100%; }
    .side-stack { grid-template-columns: 1fr; }
    .job-card { grid-template-columns: 1fr auto; }
    .job-status { grid-column: 2; grid-row: 1; }
    .progress-wrap { grid-column: 1 / -1; }
    .job-actions { grid-column: 1 / -1; justify-content: stretch; }
    .report-link { flex: 1; text-align: center; }
    .queue-pagination { align-items: flex-start; flex-direction: column; }
    .page-buttons { justify-content: flex-start; }
}

@media (max-width: 560px) {
    .auth-art { min-height: 15rem; padding: 1.5rem; }
    .auth-copy { left: 1.5rem; right: 1.5rem; bottom: 1.5rem; }
    .auth-copy h1 { max-width: 11ch; font-size: 2.25rem; }
    .auth-copy p, .auth-art::after { display: none; }
    .auth-panel { padding: 1.5rem; }
    .builder, .queue-panel { padding: .8rem; }
    .section-title { align-items: flex-start; flex-direction: column; }
}
