/* ============ FONTS ============ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Spline+Sans:wght@400;500;600;700&display=swap');

/* ============ TOKENS ============ */
:root {
  --bg: #0f1115;
  --bg-2: #161922;
  --panel: #1b1f2a;
  --panel-2: #222736;
  --line: #2c3142;
  --line-soft: #232838;
  --txt: #e8eaf0;
  --txt-dim: #9aa1b4;
  --txt-faint: #6b7186;
  --accent: #e02718;
  --accent-2: #f5512c;
  --accent-soft: rgba(224,39,24,0.14);
  --green: #5fb98a;
  --green-soft: rgba(95,185,138,0.14);
  --red: #e0726b;
  --red-soft: rgba(224,114,107,0.14);
  --blue: #6f9ee0;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px rgba(0,0,0,0.4);
  --sans: 'Spline Sans', system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(224,39,24,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(111,158,224,0.06), transparent 55%),
    var(--bg);
  color: var(--txt);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
input, select, textarea { outline: none; }
a { color: var(--accent-2); }

/* scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

/* ============ LOGIN ============ */
#login {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(224,39,24,0.16), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 38px 30px 30px;
  box-shadow: var(--shadow);
  animation: rise .6s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: none; } }
.login-mark {
  width: 76px; height: 76px; border-radius: 20px;
  display: grid; place-items: center; margin-bottom: 20px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(224,39,24,0.28);
}
.login-card h1 { font-family: var(--serif); font-weight: 500; font-size: 26px; letter-spacing: -0.01em; }
.login-card .sub { color: var(--txt-dim); font-size: 13.5px; margin: 6px 0 26px; }
.login-card label { display: block; font-size: 12px; color: var(--txt-dim); margin: 0 0 7px 2px; letter-spacing: .03em; text-transform: uppercase; font-weight: 600; }
.pin-field { position: relative; }
.pin-field input {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 46px 14px 16px; font-size: 17px; letter-spacing: 4px;
  transition: border-color .2s, box-shadow .2s;
}
.pin-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pin-field .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--txt-dim); }
.pin-field .eye:hover { color: var(--txt); background: var(--panel-2); }
.btn-primary {
  width: 100%; margin-top: 20px; padding: 14px;
  background: linear-gradient(150deg, var(--accent), #b51c10);
  color: #fff; font-weight: 700; border-radius: 12px; font-size: 15px;
  transition: transform .12s, filter .2s; letter-spacing: .01em;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.98); }
.login-err { color: var(--red); font-size: 13px; margin-top: 14px; min-height: 18px; text-align: center; }
.login-hint { color: var(--txt-faint); font-size: 11.5px; text-align: center; margin-top: 20px; line-height: 1.6; }

/* ============ APP SHELL ============ */
#app { min-height: 100%; padding-bottom: 86px; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px 14px;
  background: linear-gradient(180deg, rgba(15,17,21,0.96), rgba(15,17,21,0.82));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: #fff; flex: none;
}
.topbar .ttl { font-family: var(--serif); font-weight: 500; font-size: 19px; line-height: 1.1; }
.topbar .ttl span { display: block; font-family: var(--sans); font-size: 11px; color: var(--txt-dim); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; margin-top: 2px; }
.topbar .spacer { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--txt-dim); border: 1px solid var(--line-soft); background: var(--panel); }
.icon-btn:hover { color: var(--txt); border-color: var(--line); }

main { padding: 18px; max-width: 1100px; margin: 0 auto; }
.view { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h2 { font-family: var(--serif); font-weight: 500; font-size: 27px; letter-spacing: -0.01em; }
.view-head p { color: var(--txt-dim); font-size: 13.5px; margin-top: 3px; }

/* ============ BOTTOM NAV ============ */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(15,17,21,0.98), rgba(15,17,21,0.9));
  backdrop-filter: blur(16px); border-top: 1px solid var(--line-soft);
}
.nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px; border-radius: 12px; color: var(--txt-faint); font-size: 10px; font-weight: 600;
  letter-spacing: 0; transition: color .2s, background .2s;
}
.nav button svg { width: 21px; height: 21px; }
.nav button.active { color: var(--accent-2); }
.nav button.active .navdot { background: var(--accent); }
.navdot { width: 4px; height: 4px; border-radius: 50%; background: transparent; margin-top: 1px; }

/* segmented control (invoice filters) */
.seg { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; padding: 5px; margin-bottom: 16px; }
.seg button { flex: 1; padding: 9px 8px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--txt-dim); transition: background .2s, color .2s; }
.seg button.active { background: var(--accent-soft); color: var(--accent-2); }

/* filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { padding: 7px 13px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); color: var(--txt-dim); font-size: 13px; font-weight: 600; transition: all .15s; }
.chip:hover { border-color: var(--accent); color: var(--txt); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

/* week calendar */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-range { flex: 1; text-align: center; font-family: var(--serif); font-size: 16px; font-weight: 500; }
.cal-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
.cal { display: grid; grid-template-columns: 48px repeat(7, minmax(86px, 1fr)); position: relative; min-width: 660px; }
.cal-corner { position: sticky; left: 0; background: var(--bg-2); z-index: 3; border-bottom: 1px solid var(--line); }
.cal-dayhead { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--txt-dim); padding: 6px 2px; background: var(--bg-2); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line-soft); }
.cal-dayhead span { display: block; font-family: var(--serif); font-size: 16px; color: var(--txt); font-weight: 600; }
.cal-dayhead.today { color: var(--accent-2); }
.cal-dayhead.today span { color: var(--accent-2); }
.cal-hour { position: sticky; left: 0; background: var(--bg-2); z-index: 2; font-size: 10.5px; color: var(--txt-faint); text-align: right; padding: 2px 6px 0 0; border-top: 1px solid var(--line-soft); }
.cal-cell { border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); cursor: pointer; transition: background .12s; }
.cal-cell:hover { background: var(--panel-2); }
.cal-block { position: absolute; background: linear-gradient(150deg, var(--accent), #b51c10); color: #fff; border-radius: 6px; font-size: 10px; padding: 2px 5px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.25); z-index: 4; line-height: 1.25; }
.cal-block .cb-t { font-weight: 700; opacity: .85; }
.cal-block.manual { background: linear-gradient(150deg, #6f9ee0, #4d7fc4); }
.cal-block.s-done { box-shadow: inset 3px 0 0 var(--green), 0 1px 4px rgba(0,0,0,.25); }
.cal-block.s-noshow { box-shadow: inset 3px 0 0 #fff, 0 1px 4px rgba(0,0,0,.25); opacity: .6; text-decoration: line-through; }
.cal-block.s-latecancel { box-shadow: inset 3px 0 0 var(--accent-2), 0 1px 4px rgba(0,0,0,.25); opacity: .8; }
.cal-block:hover { filter: brightness(1.08); }

/* cashflow chart */
.cf-sec { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--txt-dim); margin: 22px 0 11px; font-weight: 700; }
.cf-sec:first-of-type { margin-top: 4px; }

/* hero "encaissé à déclarer" */
.cf-hero {
  background: linear-gradient(150deg, rgba(95,185,138,0.16), rgba(95,185,138,0.04)), var(--panel);
  border: 1px solid rgba(95,185,138,0.3); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 14px; position: relative; overflow: hidden;
}
.cf-hero::after { content:''; position:absolute; right:-30px; top:-30px; width:120px; height:120px; border-radius:50%; background: var(--green-soft); }
.cf-hero-k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--green); font-weight: 700; }
.cf-hero-v { font-family: var(--serif); font-size: 42px; font-weight: 500; letter-spacing: -0.02em; margin: 4px 0 8px; color: var(--txt); }
.cf-hero-sub { font-size: 12.5px; color: var(--txt-dim); line-height: 1.5; max-width: 540px; position: relative; }

/* quarter cards */
.cf-quarters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 4px; }
@media (min-width: 640px) { .cf-quarters { grid-template-columns: repeat(4, 1fr); } }
.cf-q { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px; }
.cf-q.current { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.cf-q.future { opacity: .55; }
.cf-q-top { display: flex; align-items: center; justify-content: space-between; }
.cf-q-t { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.cf-q-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 7px; border-radius: 6px; }
.cf-q-badge.live { background: var(--green-soft); color: var(--green); }
.cf-q-badge.done { background: var(--panel-2); color: var(--txt-faint); }
.cf-q-period { font-size: 11.5px; color: var(--txt-faint); margin-top: 2px; }
.cf-q-amt { font-family: var(--serif); font-size: 23px; font-weight: 500; color: var(--green); margin: 8px 0 4px; }
.cf-q-due { font-size: 11px; color: var(--txt-dim); }

.cf-legend { display: flex; gap: 18px; margin-bottom: 16px; font-size: 12.5px; color: var(--txt-dim); }
.cf-legend span { display: inline-flex; align-items: center; gap: 7px; }
.cf-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.cf-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 4px; }
.cf-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.cf-col.dim { opacity: .35; }
.cf-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; }
.cf-bar { border-radius: 4px 4px 0 0; min-height: 2px; transition: height .5s cubic-bezier(.2,.8,.2,1); }
.cf-bar.rec { width: 56%; max-width: 20px; background: linear-gradient(180deg, #7fd0a4, var(--green)); }
.cf-bar.inv { width: 30%; max-width: 11px; background: var(--accent-soft); border: 1px solid rgba(224,39,24,0.4); border-bottom: none; }
.cf-m { font-size: 10.5px; color: var(--txt-faint); margin-top: 7px; font-weight: 600; text-transform: uppercase; }
.cf-m span { display: none; }
@media (min-width: 560px) { .cf-m { font-size: 0; } .cf-m span { display: inline; font-size: 11px; } }

/* ============ CARDS / PANELS ============ */
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 14px; }

/* stat row */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: linear-gradient(150deg, var(--panel), var(--bg-2)); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 15px 16px; position: relative; overflow: hidden; }
.stat::after { content:''; position:absolute; right:-20px; top:-20px; width:70px; height:70px; border-radius:50%; background: var(--accent-soft); }
.stat .k { font-size: 11px; color: var(--txt-dim); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .v { font-family: var(--serif); font-size: 29px; font-weight: 500; margin-top: 6px; letter-spacing: -0.01em; }
.stat .v small { font-size: 14px; color: var(--txt-dim); font-family: var(--sans); font-weight: 500; }

/* ============ FILTER BAR ============ */
.filterbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filterbar .field { flex: 1; min-width: 160px; }
.search { display:flex; align-items:center; gap:8px; background: var(--panel); border:1px solid var(--line-soft); border-radius: 11px; padding: 0 12px; flex:1; min-width: 160px; }
.search svg { width:17px; height:17px; color: var(--txt-faint); flex:none; }
.search input { background: none; border: none; padding: 11px 0; width: 100%; }

/* ============ FORM ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; color: var(--txt-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 7px; }
.field .req { color: var(--accent); }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 13px; transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; min-height: 70px; line-height: 1.55; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239aa1b4' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.field .hint { font-size: 11.5px; color: var(--txt-faint); margin-top: 6px; }
.row { display: grid; gap: 12px; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c3 { grid-template-columns: 1fr 1fr 1fr; }

.check { display: flex; align-items: flex-start; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); cursor: pointer; }
.check input { width: 19px; height: 19px; accent-color: var(--accent); margin-top: 1px; flex: none; }
.check .ct { font-size: 13px; color: var(--txt-dim); line-height: 1.45; }
.check .ct b { color: var(--txt); display: block; font-size: 13.5px; margin-bottom: 2px; }

.btn { padding: 12px 18px; border-radius: 11px; font-weight: 600; border: 1px solid var(--line); background: var(--panel-2); transition: filter .15s, transform .12s, border-color .2s; }
.btn:hover { border-color: var(--line); filter: brightness(1.1); }
.btn:active { transform: scale(.98); }
.btn.accent { background: linear-gradient(150deg, var(--accent), #b51c10); color: #fff; border: none; }
.btn.danger { color: var(--red); border-color: var(--red-soft); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 8px 13px; font-size: 13px; border-radius: 9px; }
.btn-row { display: flex; gap: 10px; margin-top: 6px; }

/* ============ LIST / TABLE ============ */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 15px 16px; display: flex; align-items: center; gap: 14px; transition: border-color .2s, transform .12s;
}
.item:hover { border-color: var(--line); }
.avatar { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; background: linear-gradient(150deg, var(--accent-2), var(--accent)); }
.item .meta { flex: 1; min-width: 0; }
.item .meta .nm { font-weight: 600; font-size: 15px; }
.item .meta .nm b { font-family: var(--serif); font-weight: 600; }
.item .meta .sub { color: var(--txt-dim); font-size: 12.5px; margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.item .meta .sub .tag { background: var(--panel-2); padding: 2px 8px; border-radius: 6px; font-size: 11px; color: var(--txt-dim); }
.item .actions { display: flex; gap: 6px; flex: none; }

.bars { display: flex; gap: 14px; align-items: center; flex: none; }
.bar-wrap { width: 96px; }
.bar-track { height: 7px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar-fill.done { background: linear-gradient(90deg, var(--green), #7fd0a4); }
.bar-lbl { font-size: 11px; color: var(--txt-dim); margin-top: 5px; display: flex; justify-content: space-between; }
.hrs { text-align: right; flex: none; }
.hrs .big { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.hrs .lbl { font-size: 10.5px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .04em; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--accent-soft); color: var(--accent-2); }
.pill.red { background: var(--red-soft); color: var(--red); }

.empty { text-align: center; padding: 50px 20px; color: var(--txt-faint); }
.empty svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* dashboard table */
.dash-table { width: 100%; border-collapse: collapse; }
.dash-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.dash-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--txt-dim); font-weight: 600; padding: 13px 14px; background: var(--bg-2); white-space: nowrap; border-bottom: 1px solid var(--line); }
.dash-table th.num, .dash-table td.num { text-align: right; }
.dash-table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tbody tr:hover { background: var(--panel-2); }
.dash-table tr.row-done .nm b { color: var(--red); }
.dash-table tr.row-done { opacity: .9; }
.bar-fill.fdone { background: linear-gradient(90deg, var(--red), #ef8e88); }
.dash-table .nm b { font-family: var(--serif); font-weight: 600; }
.dash-table .nm small { color: var(--txt-dim); display: block; font-size: 11.5px; }
.dash-table td.num .big { font-family: var(--serif); font-size: 16px; }

/* sessions */
.sess-day { margin-top: 18px; }
.sess-day h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--txt-dim); margin-bottom: 9px; padding-left: 2px; font-weight: 700; }
.sess { display: flex; align-items: center; gap: 13px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.sess .time { font-family: var(--serif); font-size: 15px; font-weight: 600; min-width: 96px; }
.sess .time small { color: var(--txt-dim); font-family: var(--sans); font-weight: 500; display: block; font-size: 11px; }
.sess .si { flex: 1; min-width: 0; }
.sess .si .nm { font-weight: 600; }
.sess .si .cl { color: var(--txt-dim); font-size: 12.5px; }
.sess .dur { background: var(--accent-soft); color: var(--accent-2); font-weight: 700; padding: 4px 9px; border-radius: 8px; font-size: 12.5px; flex: none; }

/* ============ MODAL / SHEET ============ */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(8,9,12,0.6); backdrop-filter: blur(4px); animation: fade .25s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 92vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -16px 50px rgba(0,0,0,0.5);
  animation: sheetUp .4s cubic-bezier(.2,.85,.25,1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 640px) {
  .sheet { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%,-50%); width: 540px; max-height: 88vh; border-radius: 20px; border: 1px solid var(--line); animation: rise .35s; }
  @keyframes riseModal { from { opacity:0; transform: translate(-50%,-46%);} to {opacity:1; transform: translate(-50%,-50%);} }
  .sheet { animation: riseModal .35s cubic-bezier(.2,.8,.2,1); }
}
.grip { width: 42px; height: 4px; background: var(--line); border-radius: 4px; margin: 8px auto 14px; }
@media (min-width: 640px) { .grip { display: none; } }
.sheet h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin-bottom: 4px; }
.sheet .sub { color: var(--txt-dim); font-size: 13px; margin-bottom: 20px; }

/* invoice preview */
.inv {
  background: #fdfcf9; color: #1a1a1a; border-radius: 12px; padding: 34px 32px; font-size: 13px; line-height: 1.6;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4); font-family: var(--sans);
}
.inv h2 { font-family: var(--serif); font-size: 30px; color: #1a1a1a; font-weight: 600; }
.inv .inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 2px solid #1a1a1a; padding-bottom: 18px; margin-bottom: 20px; }
.inv .from { font-size: 12px; color: #444; }
.inv .from b { color: #1a1a1a; font-size: 14px; }
.inv .row2 { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.inv .box { flex: 1; }
.inv .box .h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: #888; font-weight: 700; margin-bottom: 5px; }
.inv .inv-desc { font-size: 13.5px; color: #1a1a1a; font-weight: 600; margin-bottom: 8px; }
.inv .inv-refs { font-size: 11.5px; color: #555; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
.inv .inv-line-name { font-weight: 600; color: #1a1a1a; }
.inv .inv-line-detail { font-size: 11px; color: #666; margin-top: 2px; line-height: 1.4; }
.manual-line { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 11px; padding: 10px; margin-bottom: 8px; }
.manual-line .ml-label { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; margin-bottom: 7px; }
.manual-line-row { display: flex; gap: 7px; }
.manual-line-row .ml-detail { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
.manual-line-row .ml-hours, .manual-line-row .ml-rate { width: 64px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 8px; }
.manual-line-row .ml-del { flex: none; width: 38px; height: 38px; }
.inv table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.inv th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: #888; border-bottom: 1.5px solid #1a1a1a; padding: 8px 6px; }
.inv th.r, .inv td.r { text-align: right; }
.inv td { padding: 9px 6px; border-bottom: 1px solid #eee; }
.inv .tot { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.inv .tot .tbox { min-width: 220px; }
.inv .tot .line { display: flex; justify-content: space-between; padding: 4px 0; }
.inv .tot .grand { border-top: 2px solid #1a1a1a; margin-top: 6px; padding-top: 8px; font-family: var(--serif); font-size: 19px; font-weight: 600; }
.inv .pay { background: #f3efe6; border-radius: 9px; padding: 14px 16px; font-size: 11.5px; color: #444; }
.inv .pay b { color: #1a1a1a; }
.inv .legal { font-size: 10px; color: #999; margin-top: 14px; line-height: 1.5; }

.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 90; background: var(--panel-2); border: 1px solid var(--line); color: var(--txt); padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: var(--green-soft); }
.toast.ok::before { content: '✓ '; color: var(--green); }

@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { position: absolute; inset: 0; padding: 0; }
  .inv { box-shadow: none; border-radius: 0; }
}
