:root {
    --navy: #593580;
    --navy-2: #6b4591;
    --blue: #593580;
    --pale-blue: #f3eef8;
    --surface: #ffffff;
    --surface-2: #eef5fb;
    --ink: #11233e;
    --muted: #5e7189;
    --line: #b9c9d9;
    --gold: #b48a31;
    --danger: #a72222;
    --success: #1d6d3b;
    --shadow: 0 14px 36px rgba(16, 45, 97, .14);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #eee7f4; }
body { margin: 0; min-height: 100vh; background: linear-gradient(#faf7fc, #e9e0f1); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.brand-band {
    min-height: 112px;
    padding: 14px clamp(18px, 4vw, 58px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: white;
    background: #593580;
    border-bottom: 4px solid #c7a14c;
    box-shadow: 0 7px 22px rgba(52, 27, 78, .28);
}

.brand-identity { display: flex; align-items: center; gap: 18px; text-decoration: none; min-width: 0; }
.brand-identity img {
    width: 96px;
    height: 90px;
    object-fit: contain;
    border-radius: 0;
    border: 0;
    filter: drop-shadow(0 0 10px rgba(240, 196, 89, .26));
    flex: 0 0 auto;
}
.brand-identity span { display: grid; line-height: 1.1; }
.brand-identity strong { font-family: Georgia, serif; font-size: clamp(2rem, 4.5vw, 3.45rem); letter-spacing: .035em; font-weight: 700; }
.brand-identity small { color: #f4ca62; font-family: Georgia, serif; font-size: clamp(.9rem, 1.6vw, 1.25rem); margin-top: 5px; }
.brand-identity em { font-style: normal; color: #d9e7f7; font-size: .85rem; margin-top: 8px; }
.account-nav { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.account-nav a, .account-nav span {
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 8px;
    padding: 9px 12px;
    text-decoration: none;
    background: rgba(255,255,255,.08);
    font-size: .86rem;
    font-weight: 700;
}
.account-nav a:hover { background: rgba(255,255,255,.18); }
.account-nav .welcome-user { color: #f7d878; border-color: rgba(247,216,120,.45); }

.layout {
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    gap: 22px;
    padding: 24px clamp(14px, 3vw, 42px) 38px;
    align-items: start;
}
.workspace { min-width: 0; display: grid; gap: 18px; }
.panel { background: rgba(255,255,255,.97); border: 1px solid rgba(63, 103, 145, .25); border-radius: 16px; box-shadow: var(--shadow); }
.form-panel { padding: 22px; position: sticky; top: 14px; }
.panel-title { border-bottom: 1px solid #d9e4ee; margin-bottom: 18px; padding-bottom: 8px; }
.panel-title h1 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 1.65rem; }
h1, h2 { font-family: Georgia, serif; font-weight: 600; }
h2 { margin: 0 0 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; color: var(--blue); font-weight: 850; margin: 0; }

label { display: grid; gap: 6px; font-weight: 700; font-size: .9rem; margin-bottom: 14px; }
input, select {
    width: 100%;
    border: 1px solid var(--line);
    background: white;
    color: #10233b;
    border-radius: 8px;
    padding: 10px 11px;
    outline: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,94,168,.13); }
.grid { display: grid; gap: 11px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.help, .privacy { color: var(--muted); font-size: .77rem; font-weight: 400; }
.primary, .button-link.primary {
    width: 100%;
    border: 0;
    border-radius: 9px;
    padding: 12px 17px;
    color: white;
    font-weight: 850;
    text-decoration: none;
    text-align: center;
    background: #593580;
    box-shadow: 0 7px 20px rgba(89,53,128,.24);
}
.primary:hover, .button-link.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: .56; cursor: wait; }
.coordinates { margin: -2px 0 15px; border: 1px dashed var(--line); border-radius: 9px; padding: 9px 11px 0; }
.coordinates summary { cursor: pointer; color: var(--muted); font-size: .82rem; margin-bottom: 11px; }
.place-field { position: relative; }
.place-results { position: absolute; z-index: 20; top: 69px; left: 0; right: 0; background: white; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); max-height: 260px; overflow: auto; }
.place-result { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #e4edf5; padding: 10px 12px; background: white; color: var(--ink); }
.place-result:hover { background: var(--surface-2); }
.place-result small { display: block; color: var(--muted); margin-top: 3px; }

.status { border-radius: 10px; padding: 11px 15px; border: 1px solid; }
.status.info { background: #eef7ff; border-color: #a8cce9; color: #174c78; }
.status.success { background: #edf8f0; border-color: #a9d4b6; color: var(--success); }
.status.error { background: #fff0f0; border-color: #e3abab; color: var(--danger); }
.chart-panel { padding: 18px; overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.section-heading h2 { margin: 0; }
.chart-heading { align-items: flex-start; border-bottom: 1px solid #dce7f0; padding-bottom: 12px; }
.chart-person-heading h2 { margin: 3px 0 5px; font-size: clamp(1.35rem, 2.2vw, 2rem); color: #173e72; text-transform: none; }
.chart-person-meta { display: grid; gap: 2px; color: var(--muted); font-size: .83rem; }
.chart-person-meta strong { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.actions button, #print-synthesis-button {
    border: 1px solid #593580;
    background: #593580;
    color: white;
    border-radius: 8px;
    padding: 8px 11px;
    font-weight: 750;
}
.chart-container { width: min(100%, 900px); margin: auto; aspect-ratio: 1; }
#chart-svg { width: 100%; height: 100%; display: block; }
.chart-panel:fullscreen { overflow: auto; background: #f3eef8; padding: 20px; }
.chart-panel:fullscreen .chart-container { height: calc(100vh - 145px); width: auto; max-width: 100%; }

.chart-bg { fill: #e8f6ff; stroke: #244f79; stroke-width: 2; }
.star { fill: #8fb6d3; opacity: .55; }
.star.bright { fill: #ffffff; stroke: #7ca4c4; stroke-width: .45; opacity: .92; }
.wheel-line { stroke: #3f5265; stroke-width: 1.05; fill: none; }
.wheel-line.tick { opacity: .66; }
.wheel-line.major { stroke-width: 2; }
.zodiac-sector { stroke: rgba(40, 55, 70, .65); stroke-width: .7; }
.zodiac-sector.fire { fill: #f2a0ad; }
.zodiac-sector.earth { fill: #b88762; }
.zodiac-sector.air { fill: #f4dc67; }
.zodiac-sector.water { fill: #8fc9ed; }
.house-line { stroke: #1f2f3d; stroke-width: 1.15; }
.house-line.angular { stroke: #1c4772; stroke-width: 2.5; }
.sign-glyph { font-size: 30px; text-anchor: middle; dominant-baseline: middle; font-family: "Segoe UI Symbol", "Noto Sans Symbols", sans-serif; font-weight: 700; paint-order: stroke; stroke: rgba(255,255,255,.58); stroke-width: 1.2px; }
.sign-glyph.fire { fill: #a41931; }
.sign-glyph.earth { fill: #603619; }
.sign-glyph.air { fill: #8a6900; }
.sign-glyph.water { fill: #0d5c9e; }
.house-number { font-size: 16px; font-weight: 850; text-anchor: middle; dominant-baseline: middle; fill: #223a54; }
.planet-label { text-anchor: middle; dominant-baseline: middle; font-family: "Segoe UI Symbol", "Noto Sans Symbols", sans-serif; paint-order: stroke; stroke: rgba(255,255,255,.82); stroke-width: 2px; }
.planet-label.natal { font-size: 26px; fill: #b01925; font-weight: 800; }
.planet-label.transit { font-size: 22px; fill: #075ba0; font-weight: 800; }
.planet-degree { font: 10px Inter, sans-serif; fill: #24394f; text-anchor: middle; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 2px; }
.retrograde-mark { font: 900 11px Inter, sans-serif; fill: #c51212; paint-order: stroke; stroke: white; stroke-width: 2px; }
.aspect-line { stroke-width: 1.2; opacity: .58; }
.aspect-line.harmonic { stroke: #2380b4; }
.aspect-line.dynamic { stroke: #d44036; }
.aspect-line.adjustment { stroke: #987516; stroke-dasharray: 5 4; }
.aspect-line.fusion { stroke: #71448d; }
.axis-label { font: 900 13px Inter, sans-serif; fill: #593580; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.axis-label.secondary { fill: #075ba0; font-size: 12px; }
.return-axis-line { stroke: #075ba0; stroke-width: 2.2; stroke-dasharray: 7 4; opacity: .9; }
.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: .81rem; }
.dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; margin-right: 5px; }
.natal-dot { background: #b01925; }
.transit-dot { background: #075ba0; }

.results-panel { overflow: hidden; }
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); background: #dfeef9; }
.tab { border: 0; background: transparent; padding: 13px 17px; font-weight: 780; color: var(--muted); white-space: nowrap; }
.tab.active { color: #593580; background: white; border-bottom: 3px solid #593580; }
.tab-content { display: none; padding: 21px; }
.tab-content.active { display: block; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th, .data-table td { border-bottom: 1px solid #dce7ef; padding: 9px 8px; text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.planet-name { font-weight: 780; white-space: nowrap; }
.planet-glyph { font-size: 1.3rem; margin-right: 6px; }
.interpretation-card, .summary-card { padding: 15px; border: 1px solid #cfdeea; border-radius: 11px; margin-bottom: 11px; background: #fbfdff; }
.interpretation-card h3, .summary-card h3 { margin: 0 0 7px; font-family: Georgia, serif; font-weight: 600; color: #173f71; }
.interpretation-card p, .summary-card p { margin: 7px 0; line-height: 1.57; }
.retrograde-box { margin-top: 10px; padding: 11px; border-left: 4px solid var(--gold); background: #fff8df; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 999px; font-size: .7rem; font-weight: 850; background: #e5edf5; }


.event-meta-line { color: #593580; font-weight: 800; margin-top: 3px; }
.event-controls { margin-top: 15px; display: grid; gap: 8px; padding: 12px; border: 1px solid #d5c7e1; border-radius: 12px; background: #faf7fc; }
.event-control-row { display: grid; grid-template-columns: minmax(112px, 145px) 38px minmax(72px, 110px) 38px minmax(82px, 110px) minmax(180px, 1fr); align-items: center; gap: 7px; opacity: .78; }
.event-control-row.active { opacity: 1; }
.event-control-row[data-event-row="solar_return"], .event-control-row[data-event-row="lunar_return"] { grid-template-columns: minmax(112px, 145px) 38px minmax(110px, 150px) 38px minmax(220px, 1fr); }
.event-mode-button, .event-step-button, .event-unit-button {
    min-height: 36px;
    border: 1px solid #593580;
    border-radius: 7px;
    background: #593580;
    color: white;
    font-weight: 850;
}
.event-mode-button.active { outline: 3px solid rgba(89,53,128,.2); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.event-step-button { font-size: 1.25rem; line-height: 1; }
.event-unit-button { background: white; color: #593580; }
.event-step-label { display: grid; grid-template-columns: auto 52px; align-items: center; gap: 5px; margin: 0; color: #593580; font-size: .78rem; }
.event-step-label input { padding: 7px 6px; text-align: center; border-color: #9e83b7; }
.event-date-output, .event-period-output { display: flex; align-items: center; min-height: 36px; padding: 7px 10px; border: 1px solid #9e83b7; border-radius: 7px; background: white; color: #2c1d3b; font-weight: 750; font-size: .82rem; }
.event-period-output { justify-content: center; color: #593580; }
.interpretation-intro { padding: 14px; margin-bottom: 18px; border-left: 5px solid #593580; background: #f7f1fb; border-radius: 8px; }
.interpretation-intro h2 { margin-bottom: 8px; }
.interpretation-intro p { margin: 0; line-height: 1.55; }
.interpretation-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.interpretation-details summary { cursor: pointer; color: #593580; font-weight: 800; }
.interpretation-details li, .house-interpretation-card li { margin: 6px 0; line-height: 1.45; }
.house-reading-title { margin-top: 34px; }
.house-interpretation-card { border-left: 4px solid #593580; }

.brand-footer {
    min-height: 62px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 18px clamp(18px, 4vw, 58px);
    color: #dceaff;
    background: #593580;
    border-top: 3px solid #c7a14c;
    font-size: .79rem;
}

/* Pages de sécurité et d’administration */
.security-main { min-height: calc(100vh - 178px); padding: 34px 18px; }
.auth-card, .access-editor { width: min(720px, 100%); margin: 0 auto; padding: clamp(22px, 4vw, 38px); }
.auth-card { max-width: 520px; }
.auth-card h1, .access-editor h1, .admin-heading h1 { margin: 5px 0 8px; color: #153f73; }
.auth-intro { color: var(--muted); line-height: 1.55; margin: 0 0 20px; }
.auth-form, .access-form { margin-top: 18px; }
.auth-form .primary { margin-top: 5px; }
.access-form .primary { max-width: 280px; }
.admin-heading { width: min(1180px, 100%); margin: 0 auto 18px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.admin-heading p { color: var(--muted); margin: 5px 0 0; }
.admin-heading .button-link { width: auto; min-width: 220px; }
.admin-message { width: min(1180px, 100%); margin: 0 auto 15px; }
.accounts-list { width: min(1180px, 100%); margin: auto; display: grid; gap: 15px; }
.account-card { padding: 20px; }
.account-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.account-card-heading h2 { margin: 0 0 3px; color: #173f71; }
.account-card-heading p { margin: 0; color: var(--muted); }
.access-status { padding: 7px 10px; border-radius: 999px; font-size: .78rem; font-weight: 850; text-align: center; }
.access-status.permanent, .access-status.valid { color: #176136; background: #e4f5e9; border: 1px solid #9bcbae; }
.access-status.expired, .access-status.invalid { color: #8c2020; background: #ffebeb; border: 1px solid #e4aaaa; }
.account-summary { display: flex; flex-wrap: wrap; gap: 9px 18px; margin: 16px 0; padding: 11px; background: #eef5fa; border-radius: 9px; font-size: .84rem; }
.device-list { border-top: 1px solid #d8e4ed; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; border-bottom: 1px solid #e3ebf2; }
.device-row small { display: block; color: var(--muted); margin-top: 4px; }
.danger-button { border: 1px solid #cf8f8f; background: #fff4f4; color: #912424; border-radius: 7px; padding: 7px 10px; font-weight: 750; }
.delete-account { text-align: right; margin-top: 12px; }
.danger-link { border: 0; background: transparent; color: #a22424; text-decoration: underline; font-size: .8rem; }
.empty-devices { color: var(--muted); font-style: italic; }

@media (max-width: 820px) {
    .event-control-row, .event-control-row[data-event-row="solar_return"], .event-control-row[data-event-row="lunar_return"] {
        grid-template-columns: minmax(105px, 1fr) 38px minmax(82px, 1fr) 38px;
    }
    .event-step-label, .event-date-output { grid-column: span 2; }
    .event-period-output { min-width: 0; }
}

@media (max-width: 1000px) {
    .layout { grid-template-columns: 1fr; }
    .form-panel { position: static; }
}
@media (max-width: 760px) {
    .brand-band { align-items: flex-start; flex-direction: column; }
    .brand-identity img { width: 78px; height: 72px; }
    .account-nav { justify-content: flex-start; }
    .brand-identity em { display: none; }
    .admin-heading, .account-card-heading { align-items: stretch; flex-direction: column; }
    .admin-heading .button-link { width: 100%; }
}
@media (max-width: 620px) {
    .grid.two, .grid.three { grid-template-columns: 1fr; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .actions { justify-content: flex-start; }
    .chart-panel { padding: 9px; }
    .tab-content { padding: 14px; }
    .data-table { font-size: .77rem; }
    .brand-footer { flex-direction: column; align-items: flex-start; }
    .device-row { align-items: flex-start; flex-direction: column; }
}

@media print {
    body { background: white; }
    .brand-band, .form-panel, .status, .brand-footer, .tabs, .actions, .legend, .event-controls { display: none !important; }
    .layout { display: block; padding: 0; }
    .panel { box-shadow: none; border: 0; }
    body.print-chart .results-panel { display: none !important; }
    body.print-chart .chart-panel { display: block !important; }
    body.print-chart .chart-container { width: 180mm; }
    body.print-summary .chart-panel { display: none !important; }
    body.print-summary .results-panel { display: block !important; }
    body.print-summary .tab-content { display: none !important; }
    body.print-summary #synthesis { display: block !important; padding: 0; }
    #print-synthesis-button { display: none !important; }
}
.diagnostic-list { list-style: none; padding: 0; }
.diagnostic-list li { margin: 9px 0; font-weight: 700; }
.diagnostic-ok { color: var(--success); }
.diagnostic-bad { color: var(--danger); }
code { background: #e7eff6; padding: 2px 5px; border-radius: 4px; }
