:root {
    --ink: #322923;
    --muted: #6f625a;
    --brand: #5f4e44;
    --brand-2: #8f7466;
    --paper: #f8f3ed;
    --paper-2: #eee5dc;
    --line: #ddd0c5;
    --sage: #7c8b72;
    --gold: #a9826f;
    --danger: #b9564f;
    --white: #fffdf9;
    --shadow: 0 18px 42px rgba(69, 49, 39, 0.11);
    --shadow-soft: 0 8px 24px rgba(69, 49, 39, 0.07);
}

* { box-sizing: border-box; }

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

body.ats-app {
    margin: 0;
    min-height: 100vh;
    font-family: "Noto Serif TC", "Noto Sans TC", serif;
    background:
        linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(248, 243, 237, 0.98)),
        radial-gradient(circle at 8% 0%, rgba(143, 116, 102, 0.1), transparent 34%),
        radial-gradient(circle at 92% 86%, rgba(124, 139, 114, 0.1), transparent 32%);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.ats-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.ats-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 0 18px;
    min-width: 0;
}

.ats-brand {
    text-decoration: none;
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}

.ats-brand-mark {
    color: var(--brand);
    font-size: 1.45rem;
    letter-spacing: 0.14em;
    line-height: 1;
}

.ats-brand-name {
    font-family: "Noto Sans TC", sans-serif;
    color: var(--muted);
    font-size: 0.76rem;
    letter-spacing: 0.34em;
}

.ats-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
}

.ats-nav a,
.ats-nav button,
.ats-btn {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 16px;
    background: rgba(255, 253, 249, 0.76);
    color: var(--brand);
    text-decoration: none;
    font: 600 0.92rem "Noto Sans TC", sans-serif;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
    max-width: 100%;
    white-space: nowrap;
}

.ats-nav a:hover,
.ats-nav button:hover,
.ats-btn:hover {
    transform: translateY(-1px);
    background: var(--white);
    border-color: var(--brand-2);
}

.ats-btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--white);
}

.ats-btn.ghost {
    background: transparent;
}

.ats-hero {
    padding: 44px 0 30px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 36px;
    align-items: end;
}

.ats-kicker {
    margin: 0 0 12px;
    color: var(--gold);
    font-family: "Noto Sans TC", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.ats-hero h1,
.ats-page-title {
    margin: 0;
    color: var(--brand);
    font-size: clamp(2.2rem, 6vw, 5rem);
    line-height: 1.02;
    font-weight: 600;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.ats-hero p,
.ats-page-lead {
    margin: 18px 0 0;
    max-width: 620px;
    color: var(--muted);
    font-size: 1.02rem;
}

.ats-panel {
    background: rgba(255, 253, 249, 0.92);
    border: 1px solid rgba(221, 208, 197, 0.9);
    border-radius: 26px;
    box-shadow: var(--shadow-soft);
    padding: 24px;
    min-width: 0;
}

.ats-welcome-panel {
    border-radius: 30px;
    padding: 28px;
}

.ats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 18px 0 44px;
}

.ats-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ats-card {
    min-height: 210px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 26px;
    padding: 20px;
    text-decoration: none;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ats-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--brand-2);
}

.ats-card:first-child { border-top-left-radius: 34px; }
.ats-card:last-child { border-bottom-right-radius: 34px; }

.ats-card span {
    color: var(--gold);
    font-family: "Noto Sans TC", sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.ats-card h2 {
    margin: 14px 0 8px;
    color: var(--brand);
    font-size: 1.42rem;
    line-height: 1.22;
}

.ats-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.ats-page {
    padding: 28px 0 72px;
}

.ats-stack {
    display: grid;
    gap: 18px;
    margin-top: 26px;
}

.ats-form {
    display: grid;
    gap: 14px;
}

.ats-form label {
    display: grid;
    gap: 6px;
    color: var(--brand);
    font-weight: 700;
}

.ats-form input,
.ats-form select,
.ats-form textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 11px 13px;
    background: var(--white);
    color: var(--ink);
    font: 1rem "Noto Sans TC", sans-serif;
}

.ats-status {
    min-height: 1.4em;
    color: var(--muted);
    font-size: 0.92rem;
}

.ats-status.error { color: var(--danger); }
.ats-status.success { color: var(--sage); }

.ats-list {
    display: grid;
    gap: 12px;
}

.ats-list-item {
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 16px;
    background: var(--white);
    min-width: 0;
    overflow-wrap: anywhere;
}

.ats-list-item h3 {
    margin: 0 0 6px;
    color: var(--brand);
}

.ats-list-item p {
    margin: 0;
    color: var(--muted);
}

.ats-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.ats-dashboard-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.ats-dashboard-hero h2 {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.ats-dashboard-hero p {
    margin: 0;
    color: var(--muted);
}

.ats-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.ats-metric {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 253, 249, 0.9);
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.ats-metric span {
    display: block;
    color: var(--muted);
    font: 700 0.78rem "Noto Sans TC", sans-serif;
    text-transform: uppercase;
}

.ats-metric strong {
    display: block;
    margin-top: 8px;
    color: var(--brand);
    font-size: 2rem;
    line-height: 1;
}

.ats-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.ats-tabs button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    background: rgba(255, 253, 249, 0.82);
    color: var(--brand);
    font: 700 0.9rem "Noto Sans TC", sans-serif;
    cursor: pointer;
}

.ats-tabs button.active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--white);
}

.ats-booking-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.ats-booking-meta {
    display: grid;
    gap: 4px;
    min-width: 108px;
    text-align: right;
    color: var(--muted);
    font: 700 0.88rem "Noto Sans TC", sans-serif;
}

.ats-booking-meta strong {
    color: var(--brand);
}

.ats-flow-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.ats-flow-step {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 253, 249, 0.82);
    padding: 14px;
}

.ats-flow-step span {
    display: block;
    color: var(--gold);
    font: 700 0.72rem "Noto Sans TC", sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ats-flow-step strong {
    display: block;
    margin-top: 4px;
    color: var(--brand);
}

.ats-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.ats-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid rgba(143, 116, 102, 0.32);
    border-radius: 999px;
    padding: 2px 9px;
    color: var(--gold);
    background: rgba(143, 116, 102, 0.08);
    font: 700 0.74rem "Noto Sans TC", sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ats-split {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 18px;
    align-items: start;
}

@media (max-width: 860px) {
    .ats-topbar { align-items: flex-start; flex-direction: column; }
    .ats-nav { justify-content: flex-start; }
    .ats-hero { grid-template-columns: 1fr; padding-top: 26px; }
    .ats-grid,
    .ats-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ats-split { grid-template-columns: 1fr; }
    .ats-dashboard-hero { align-items: flex-start; flex-direction: column; }
    .ats-metric-grid,
    .ats-flow-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .ats-shell { width: min(100% - 24px, 1120px); }
    .ats-topbar { gap: 12px; }
    .ats-nav {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .ats-nav::-webkit-scrollbar { display: none; }
    .ats-nav a,
    .ats-nav button {
        flex: 0 0 auto;
    }
    .ats-grid,
    .ats-grid-three { grid-template-columns: 1fr; }
    .ats-metric-grid,
    .ats-flow-strip { grid-template-columns: 1fr; }
    .ats-booking-row { flex-direction: column; }
    .ats-booking-meta { text-align: left; }
    .ats-nav a,
    .ats-nav button,
    .ats-btn { padding-inline: 13px; font-size: 0.86rem; }
    .ats-hero h1,
    .ats-page-title { font-size: clamp(2rem, 13vw, 3.25rem); }
    .ats-card { min-height: 0; }
}
