:root {
  --wine: #6f2942;
  --wine-2: #8f3f5c;
  --rose: #d9a4ad;
  --blush: #f8efed;
  --cream: #fffaf7;
  --ink: #30252a;
  --muted: #7c6d72;
  --line: #eadfdd;
  --white: #fff;
  --green: #1f765b;
  --red: #a43d4a;
  --shadow: 0 18px 55px rgba(82, 42, 55, .10);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--cream); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 100% 0, #f4dedf 0, transparent 30%), var(--cream); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1.02; color: var(--wine); }
h2 { margin-bottom: 5px; color: var(--wine); font-size: 1.45rem; }
p { color: var(--muted); line-height: 1.6; }
code { padding: 3px 7px; border-radius: 7px; background: #f4e8e7; }

.eyebrow { display: block; margin-bottom: 10px; color: var(--wine-2); font-size: .72rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 12px; padding: 10px 16px; font-weight: 800; cursor: pointer; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: linear-gradient(135deg, var(--wine), var(--wine-2)); box-shadow: 0 10px 24px rgba(111, 41, 66, .2); }
.button.secondary { color: var(--wine); border-color: var(--line); background: white; }
.button.wide { width: 100%; }
.alert { margin-bottom: 20px; border-radius: 14px; padding: 14px 17px; font-weight: 650; }
.alert.success { color: var(--green); background: #e8f5ef; }
.alert.error { color: var(--red); background: #fdebec; }

.login-body, .install-body { display: grid; min-height: 100vh; place-items: center; padding: 28px; }
.login-shell { display: grid; width: min(980px, 100%); grid-template-columns: 1.08fr .92fr; overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 30px; background: white; box-shadow: var(--shadow); }
.login-brand { position: relative; display: flex; min-height: 620px; flex-direction: column; justify-content: center; padding: clamp(40px, 7vw, 80px); color: white; background: linear-gradient(145deg, rgba(85,24,48,.96), rgba(138,59,85,.9)), radial-gradient(circle at 70% 20%, #e6b9bf, transparent 35%); }
.login-brand::after { position: absolute; right: -80px; bottom: -120px; width: 320px; height: 320px; border: 1px solid rgba(255,255,255,.19); border-radius: 50%; content: ""; box-shadow: 0 0 0 45px rgba(255,255,255,.035), 0 0 0 90px rgba(255,255,255,.025); }
.login-brand .eyebrow, .login-brand p { color: #f8dfe3; }
.login-brand h1 { color: white; font-size: clamp(3.3rem, 7vw, 5.4rem); }
.login-brand p { max-width: 380px; font-size: 1.05rem; }
.brand-mark { display: grid; width: 48px; height: 48px; place-items: center; flex: 0 0 auto; border-radius: 15px; color: white; background: linear-gradient(135deg, var(--wine), var(--wine-2)); font-family: Georgia, serif; font-weight: 800; box-shadow: 0 10px 25px rgba(61, 20, 37, .18); }
.login-brand > .brand-mark { margin-bottom: 38px; color: var(--wine); background: #fff2ef; }
.cash-pill { display: inline-flex; width: fit-content; align-items: center; border-radius: 100px; padding: 7px 12px; color: var(--wine); background: #fae8e8; font-size: .76rem; font-weight: 800; }
.login-brand .cash-pill { margin-top: 16px; color: white; background: rgba(255,255,255,.14); }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(34px, 6vw, 68px); }
.login-card h2 { font-size: 2.2rem; }
.stack-form { display: grid; gap: 16px; }
.stack-form label, .install-form label, .form-grid label { display: grid; gap: 7px; }
.stack-form label > span, .install-form label > span, .form-grid label > span { color: #594a50; font-size: .82rem; font-weight: 800; }
input, select, textarea { width: 100%; min-height: 45px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; outline: none; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(217,164,173,.18); }
input:disabled { color: var(--muted); background: #f8f4f3; }
label small { color: var(--muted); font-size: .72rem; }

.install-card { width: min(680px, 100%); border-radius: 28px; padding: clamp(30px, 6vw, 62px); background: white; box-shadow: var(--shadow); }
.install-card h1 { font-size: clamp(2.2rem, 6vw, 3.5rem); }
.install-form { display: grid; gap: 15px; margin-top: 25px; }
.credentials { display: grid; gap: 7px; margin: 22px 0; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.credentials strong { color: var(--wine); }
.danger-note { margin-top: 22px; border-left: 4px solid var(--wine); padding-left: 14px; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 28px 20px; color: #f9edef; background: linear-gradient(180deg, #5f2238 0%, #7d304b 65%, #4f1d31 100%); }
.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; }
.logo .brand-mark { color: var(--wine); background: #fff1ee; }
.logo strong, .logo small { display: block; }
.logo strong { color: white; font-family: Georgia, serif; font-size: 1.25rem; }
.logo small { margin-top: 2px; color: #e9c9cf; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 7px; }
.sidebar nav a { border-radius: 12px; padding: 12px 14px; color: #edcfd5; font-size: .9rem; font-weight: 700; }
.sidebar nav a:hover, .sidebar nav a.active { color: white; background: rgba(255,255,255,.13); }
.sidebar-foot { display: grid; gap: 14px; margin-top: auto; }
.user-chip { display: flex; align-items: center; gap: 11px; border-top: 1px solid rgba(255,255,255,.14); padding-top: 20px; }
.user-chip > span { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 50%; color: var(--wine); background: #fff0ed; font-weight: 900; }
.user-chip strong, .user-chip small { display: block; }
.user-chip small { color: #e5c3ca; font-size: .7rem; }
.logout-button { border: 0; padding: 0; color: #edcfd5; background: none; cursor: pointer; font-size: .76rem; }
.main-content { min-width: 0; padding: 38px clamp(24px, 4vw, 62px) 70px; }
.mobile-header { display: none; }
.mobile-account { display: flex; align-items: center; gap: 10px; }
.mobile-account > span { color: var(--muted); font-size: .78rem; font-weight: 750; }
.mobile-logout { border: 0; border-radius: 9px; padding: 7px 9px; color: var(--wine); background: var(--blush); font-size: .7rem; font-weight: 800; cursor: pointer; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 28px; }
.page-heading p { margin-bottom: 0; }
.period-picker { display: flex; align-items: center; gap: 9px; padding: 8px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.75); }
.period-picker input { width: 150px; min-height: 39px; }
.segment { display: flex; padding: 3px; border-radius: 10px; background: #f3e9e8; }
.segment button { min-height: 34px; border: 0; border-radius: 8px; padding: 7px 11px; color: var(--muted); background: transparent; font-size: .76rem; font-weight: 800; cursor: pointer; }
.segment button.active { color: var(--wine); background: white; box-shadow: 0 4px 12px rgba(72,36,49,.09); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.metric-card { min-height: 150px; border: 1px solid var(--line); border-radius: 19px; padding: 22px; background: rgba(255,255,255,.9); box-shadow: 0 10px 35px rgba(72,42,52,.05); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { margin-bottom: 16px; font-size: .78rem; font-weight: 800; }
.metric-card strong { display: block; margin-bottom: 12px; color: var(--wine); font-family: Georgia, serif; font-size: clamp(1.55rem, 2.6vw, 2.1rem); }
.metric-card small { font-size: .72rem; }
.metric-card.rose { color: white; border-color: transparent; background: linear-gradient(145deg, var(--wine), #9a4962); }
.metric-card.rose span, .metric-card.rose small, .metric-card.rose strong { color: white; }
.metric-card.positive strong { color: var(--green); }
.metric-card.negative strong { color: var(--red); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr); gap: 18px; margin-bottom: 18px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 20px; padding: 22px; background: rgba(255,255,255,.92); box-shadow: 0 12px 38px rgba(72,42,52,.055); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.panel-head h2, .panel-head p { margin-bottom: 0; }
.panel-head p { font-size: .8rem; }
.panel-total { color: var(--green); font-family: Georgia, serif; font-size: 1.45rem; }
.panel-total.expense { color: var(--red); }
.bar-chart { display: flex; height: 260px; align-items: flex-end; gap: 6px; overflow-x: auto; padding-top: 28px; }
.bar-item { display: grid; min-width: 25px; height: 100%; flex: 1 0 25px; grid-template-rows: 18px 1fr 18px; align-items: end; text-align: center; }
.bar-item small, .bar-value { color: var(--muted); font-size: .62rem; }
.bar-value { overflow: hidden; }
.bar-track { position: relative; height: 100%; overflow: hidden; border-radius: 9px; background: #f4e9e8; }
.bar-track i { position: absolute; right: 0; bottom: 0; left: 0; min-height: 3px; border-radius: 9px; background: linear-gradient(180deg, #d79aa7, var(--wine)); }
.owner-list { display: grid; gap: 12px; }
.owner-list div { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 10px 0; }
.owner-list div:last-child { border-bottom: 0; }
.owner-list span { color: var(--muted); }
.owner-list strong { color: var(--wine); }
.empty { color: var(--muted); padding: 20px !important; text-align: center; }

.entry-layout { display: grid; grid-template-columns: minmax(310px, .65fr) minmax(0, 1.35fr); gap: 18px; align-items: start; }
.form-panel { position: sticky; top: 25px; }
.receipt-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.receipt-overview article { border: 1px solid var(--line); border-radius: 16px; padding: 17px 18px; background: rgba(255,255,255,.9); }
.receipt-overview span, .receipt-overview small { display: block; color: var(--muted); }
.receipt-overview span { margin-bottom: 9px; font-size: .74rem; font-weight: 800; }
.receipt-overview strong { display: block; margin-bottom: 5px; color: var(--wine); font-family: Georgia, serif; font-size: 1.55rem; }
.receipt-overview small { font-size: .7rem; }
.detail-help { margin-top: 15px; border-radius: 13px; padding: 14px 15px; color: #6e5760; background: var(--blush); }
.detail-help strong { color: var(--wine); }
.detail-help p { margin: 5px 0 0; font-size: .8rem; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin: 18px 0; }
.summary-list { display: grid; gap: 4px; }
.summary-list > div { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid #f0e7e5; padding: 10px 3px; }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list span strong, .summary-list span small { display: block; }
.summary-list span small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.summary-list b { color: var(--green); white-space: nowrap; }
.imported-panel { margin-top: 18px; }
.imported-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; }
.imported-grid div { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 11px; background: #fffaf8; }
.imported-grid span { color: var(--muted); font-size: .74rem; }
.imported-grid strong { color: var(--wine); font-size: .82rem; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.fixed-cash { border-radius: 11px; padding: 11px 13px; color: var(--wine); background: var(--blush); font-size: .8rem; font-weight: 800; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th { border-bottom: 1px solid var(--line); padding: 10px; color: var(--muted); text-align: left; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }
td { border-bottom: 1px solid #f0e7e5; padding: 12px 10px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); }
.amount { color: var(--green); font-weight: 850; white-space: nowrap; }
.amount.expense { color: var(--red); }
.tag { display: inline-flex; border-radius: 50px; padding: 5px 8px; color: var(--wine); background: var(--blush); font-size: .7rem; font-weight: 750; }
.icon-button { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--red); background: white; cursor: pointer; }
.today-total { min-width: 190px; border-radius: 17px; padding: 18px 20px; color: white; background: linear-gradient(135deg, var(--wine), var(--wine-2)); }
.today-total span, .today-total strong { display: block; }
.today-total span { margin-bottom: 7px; font-size: .72rem; }
.today-total strong { font-family: Georgia, serif; font-size: 1.55rem; }
.employee-layout { grid-template-columns: minmax(310px, .75fr) minmax(0, 1.25fr); }

.settings-grid { display: grid; gap: 18px; }
.user-settings, .charge-list { display: grid; gap: 9px; }
.user-setting, .charge-row { display: grid; grid-template-columns: minmax(220px,1fr) minmax(180px,.7fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 13px; padding: 12px; }
.user-setting div span, .user-setting div small, .charge-row div small { display: block; color: var(--muted); font-size: .72rem; }
.charge-row { grid-template-columns: minmax(230px, 1fr) 130px 80px auto; }
.toggle { display: flex; align-items: center; gap: 7px; font-size: .78rem; }
.toggle input { width: 18px; min-height: 18px; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .entry-layout { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .form-panel { position: static; }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 245px; padding: 32px; }
  .login-brand h1 { margin-bottom: 5px; font-size: 3rem; }
  .login-brand > .brand-mark { margin-bottom: 20px; }
  .login-brand p { margin-bottom: 8px; }
  .login-card { padding: 38px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 20; width: 100%; height: auto; border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); color: var(--ink); background: rgba(255,255,255,.99); box-shadow: 0 -10px 30px rgba(72,42,52,.10); }
  .sidebar .logo, .sidebar-foot { display: none; }
  .sidebar nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
  .sidebar nav a { padding: 10px 4px; color: var(--muted); text-align: center; font-size: .68rem; }
  .sidebar nav a:hover, .sidebar nav a.active { color: var(--wine); background: var(--blush); }
  .sidebar nav a:only-child { grid-column: 1 / -1; }
  .main-content { padding: 18px 15px 90px; }
  .mobile-header { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; margin: -18px -15px 22px; border-bottom: 1px solid var(--line); padding: 12px 15px; background: rgba(255,250,247,.99); box-shadow: 0 7px 22px rgba(72,42,52,.06); }
  .mobile-header .logo { margin: 0; }
  .logo.compact .brand-mark { width: 38px; height: 38px; }
  .logo.compact strong { color: var(--wine); font-size: 1rem; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 16px; margin-bottom: 20px; }
  .page-heading h1 { font-size: 2.15rem; }
  .page-heading p { font-size: .88rem; }
  .period-picker { display: grid; width: 100%; grid-template-columns: 1fr auto; gap: 8px; }
  .period-picker .segment { grid-column: 1 / -1; }
  .period-picker .segment button { flex: 1; }
  .period-picker input { width: 100%; min-width: 0; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .receipt-overview { grid-template-columns: 1fr; }
  .metric-card { min-height: 130px; padding: 16px; }
  .metric-card strong { font-size: 1.45rem; }
  .panel { padding: 16px; }
  .panel-head { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .user-setting, .charge-row { grid-template-columns: 1fr; }
  .today-total { width: 100%; }
  .bar-chart { height: 220px; }
  th, td { padding: 10px 8px; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tbody { display: grid; gap: 10px; }
  .responsive-table tr { position: relative; border: 1px solid var(--line); border-radius: 13px; padding: 9px 10px; background: white; }
  .responsive-table td { display: flex; min-height: 35px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid #f1e8e6; padding: 7px 3px; text-align: right; }
  .responsive-table td:last-child { border-bottom: 0; }
  .responsive-table td::before { flex: 0 0 auto; color: var(--muted); content: attr(data-label); font-size: .68rem; font-weight: 800; text-align: left; text-transform: uppercase; }
  .responsive-table td[data-label="Prestation"] { align-items: flex-start; }
  .responsive-table td[data-label="Prestation"] strong { color: var(--wine); }
  .responsive-table .amount { font-size: .95rem; }
  .responsive-table .table-action { min-height: 30px; justify-content: flex-end; border-bottom: 0; }
  .responsive-table .table-action::before { display: none; }
  .responsive-table .empty { display: block; text-align: center; }
  .responsive-table .empty::before { display: none; }
}

@media (max-width: 430px) {
  .login-body, .install-body { padding: 12px; }
  .login-shell, .install-card { border-radius: 22px; }
  .login-brand { min-height: 220px; padding: 26px; }
  .login-brand h1 { font-size: 2.55rem; }
  .login-card { padding: 28px 22px; }
  .metric-grid { grid-template-columns: 1fr; }
  .sidebar nav a { font-size: .6rem; }
  .mobile-account > span { display: none; }
  .logo.compact strong { font-size: .9rem; }
}
