:root {
  --forest: #123c26;
  --green: #3c7a52;
  --green-soft: #e6f0e9;
  --gold: #c39a3c;
  --gold-soft: #f6efdd;
  --gold-dark: #8a6a15;
  --ink: #1b241f;
  --muted: #5d6a62;
  --line: #dde4df;
  --bg: #f6f7f4;
  --card: #ffffff;
  --red: #b3261e;
  --red-soft: #fbe9e7;
  --amber: #9a6300;
  --amber-soft: #fff3dc;
  --blue: #1f5f99;
  --blue-soft: #e5eef8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 60, 38, .06), 0 4px 16px rgba(18, 60, 38, .06);
  font-family: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; color: var(--forest); margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }

/* top bar */
.topbar { background: var(--forest); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: .5rem; font-family: 'Fraunces', Georgia, serif; font-size: 1.1rem; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--forest); border: 2px solid var(--gold); position: relative; }
.brand-mark::after { content: ''; position: absolute; left: 3px; right: 3px; top: 7px; height: 9px; border: 2.5px solid var(--gold); border-bottom: 0; border-radius: 10px 10px 0 0; }
#nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
#nav a { color: #d7e6dc; text-decoration: none; padding: .35rem .65rem; border-radius: 8px; font-weight: 500; font-size: .95rem; }
#nav a.active, #nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.link-btn { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: .35rem .5rem; text-decoration: underline; }
.signout { color: #d7e6dc; }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 4rem; outline: none; }
.narrow { max-width: 560px; margin: 0 auto; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grid.two { grid-template-columns: 340px 1fr; align-items: start; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; }
.stat .num { font-size: 1.6rem; font-weight: 700; color: var(--forest); }
.stat .lbl { color: var(--muted); font-size: .85rem; }

/* buttons + inputs */
button, .btn { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: .6rem 1rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; }
.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: #0d2e1d; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-dark); }
.btn-ghost { background: #fff; color: var(--forest); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green); }
.btn-danger { background: #fff; color: var(--red); border-color: #efc7c3; }
.btn-big { width: 100%; padding: 1rem; font-size: 1.1rem; border-radius: 14px; }
.btn-sm { padding: .35rem .65rem; font-size: .875rem; border-radius: 8px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

label { display: block; font-weight: 600; font-size: .9rem; margin: .7rem 0 .25rem; }
input, select, textarea { font: inherit; width: 100%; padding: .55rem .65rem; border: 1px solid #c9d3cc; border-radius: 9px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(195, 154, 60, .45); outline-offset: 1px; border-color: var(--gold); }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; margin-right: .4rem; }
.check { display: flex; align-items: center; font-weight: 500; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* badges */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-gold { background: var(--gold-soft); color: var(--gold-dark); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-grey { background: #eef1ef; color: var(--muted); }

.alert { border-radius: 10px; padding: .75rem .9rem; margin: .5rem 0 1rem; }
.alert-red { background: var(--red-soft); color: #7d1a14; }
.alert-amber { background: var(--amber-soft); color: #6b4500; }
.alert-green { background: var(--green-soft); color: #1d4d2f; }
.alert-blue { background: var(--blue-soft); color: #173f66; }

/* clock */
.clock-time { font-size: 2.2rem; font-weight: 700; color: var(--forest); font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

/* timesheet lines */
.line { border: 1px solid var(--line); border-radius: 10px; padding: .75rem; margin-bottom: .6rem; background: #fbfcfa; }
.line-grid { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .line-grid { grid-template-columns: 1.2fr 2.4fr .7fr 1fr; align-items: end; } }
.line label { margin-top: 0; font-size: .8rem; }
.line-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .4rem; }
.total { font-weight: 700; color: var(--forest); }
.strike { text-decoration: line-through; color: var(--muted); margin-right: .3rem; }

/* auth screens */
.auth { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.auth .card { padding: 2rem 1.5rem; }
.auth .logo { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 14px; background: var(--forest); position: relative; }
.auth .logo::after { content: ''; position: absolute; left: 12px; right: 12px; top: 18px; height: 20px; border: 5px solid var(--gold); border-bottom: 0; border-radius: 30px 30px 0 0; }
.auth label { text-align: left; }
.tagline { color: var(--gold-dark); font-weight: 600; letter-spacing: .02em; font-size: .9rem; }

.copybox { display: flex; gap: .4rem; margin-top: .4rem; }
.copybox input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }

#toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: var(--forest); color: #fff; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 50; }
#toast.show { opacity: 1; }
#toast.err { background: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.right { text-align: right; }
.mt { margin-top: 1rem; }
.nowrap { white-space: nowrap; }
.w-date { max-width: 180px; }
.mt-xs { margin-top: .25rem; }
.mt-s { margin-top: .4rem; }
.ml { margin-left: .4rem; }
.hours-input { max-width: 90px; text-align: right; }
.nav-count { display: inline-block; min-width: 1.3em; margin-left: .35rem; padding: 0 .35em; border-radius: 999px; background: var(--gold); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.4; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
.reminders h2 { font-size: 1.05rem; }
.day-check { margin: 0 .6rem 0 0; font-weight: 500; }
.install { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
[hidden] { display: none !important; }
.qr { display: block; width: 220px; height: 220px; image-rendering: pixelated; margin: .6rem 0; border: 1px solid var(--line); border-radius: 8px; }
.secret, pre.codes { font-family: ui-monospace, Menlo, Consolas, monospace; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .2rem .4rem; }
pre.codes { padding: .6rem .8rem; font-size: 1rem; line-height: 1.7; white-space: pre-wrap; margin: .5rem 0; }
ol.steps { padding-left: 1.2rem; margin: .2rem 0 .6rem; }
ol.steps li { margin-bottom: .25rem; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; }
.invite-box h2 { margin-bottom: .3rem; }
.invite-grid { display: grid; gap: 1rem; }
@media (min-width: 800px) { .invite-grid { grid-template-columns: 260px 1fr; } }
.phone-code { background: #fff; border: 2px dashed var(--gold); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .7rem; }
.code-digits { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 2rem; font-weight: 700; letter-spacing: .12em; color: var(--forest); }

/* ---------- phone layout: compact top bar + bottom tabs ---------- */
.topbar { padding-top: env(safe-area-inset-top); }
.tabbar, .sheet-backdrop { display: none; }
@media (max-width: 760px) {
  #nav, .signout { display: none; }
  .topbar-inner { padding: .55rem 1rem; }
  .brand { font-size: 1.05rem; }
  main { padding: 1rem .85rem calc(5.5rem + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.4rem; }
  .card { padding: 1rem; }
  .tabbar:not([hidden]) {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: #fff; border-top: 1px solid var(--line);
    padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(18, 60, 38, .06);
  }
  .tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: .1rem;
    padding: .35rem 0; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600;
    background: none; border: 0; border-radius: 10px; font-family: inherit; }
  .tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab.active { color: var(--forest); }
  .tab.active svg { stroke-width: 2.2; }
  .tab .nav-count { position: absolute; top: .1rem; left: calc(50% + 6px); margin: 0; }
  .sheet-backdrop:not([hidden]) { display: flex; align-items: flex-end; position: fixed; inset: 0; z-index: 30; background: rgba(10, 30, 20, .35); }
  .sheet { width: 100%; background: #fff; border-radius: 18px 18px 0 0; padding: .4rem .75rem calc(1rem + env(safe-area-inset-bottom)); }
  .sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: .3rem auto .6rem; }
  .sheet-link { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: .9rem .6rem;
    color: var(--ink); text-decoration: none; font-size: 1.02rem; font-weight: 500; border: 0; border-bottom: 1px solid var(--line);
    background: none; font-family: inherit; text-align: left; border-radius: 0; }
  .sheet-link.active { color: var(--forest); font-weight: 700; }
  .sheet-signout { color: var(--red); border-bottom: 0; }
  #toast { bottom: calc(5.2rem + env(safe-area-inset-bottom)); }
  .grid.two { grid-template-columns: 1fr; }
  table { font-size: .88rem; }
}

/* ---------- month-end close ---------- */
.close-item { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.close-check { margin: 0; font-weight: 500; flex: 1; min-width: 200px; }
.close-check input { width: 18px; height: 18px; flex: none; }
.is-done .close-check span { text-decoration: line-through; color: var(--muted); }
.hint.full { flex-basis: 100%; margin-top: 0; }
.close-progress { display: flex; align-items: center; gap: .6rem; }
.progress { width: 140px; height: 8px; border-radius: 99px; background: #e8ece9; overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 99px; transition: width .2s; }
.progress-fill.full { background: var(--green); }
.close-table select, .close-table input[type=date] { min-width: 140px; }
.stat .num.red { color: var(--red); }
details { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .6rem; }
details summary { cursor: pointer; font-weight: 600; color: var(--forest); padding: .2rem 0; }
details[open] summary { margin-bottom: .4rem; }
.note-text { white-space: pre-wrap; background: #fbfcfa; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; }
.money-input { max-width: 120px; text-align: right; }

/* ---------- completion letter ---------- */
@media (min-width: 900px) { .grid.two.letter-grid { grid-template-columns: 360px 1fr; } }
.letter { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 2.5rem 2.75rem; font-family: Georgia, 'Times New Roman', serif; font-size: 1.02rem; line-height: 1.65; color: #111; min-height: 600px; }
.letter-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--forest); padding-bottom: .6rem; margin-bottom: 1.6rem; gap: 1rem; }
.letter-company { font-family: 'Fraunces', Georgia, serif; font-size: 1.35rem; color: var(--forest); font-weight: 600; }
.letter-title { text-align: center; text-transform: uppercase; letter-spacing: .08em; font-size: 1rem; margin: 1rem 0 1.4rem; color: #111; }
.letter p { margin-bottom: 1.05em; }
.letter-sign { margin-top: 2.2rem; }
.sign-line { display: inline-block; width: 220px; border-bottom: 1px solid #333; height: 3rem; }
@media print {
  @page { margin: 18mm; }
  body { background: #fff; }
  .topbar, .tabbar, .sheet-backdrop, #toast, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  .grid.two.letter-grid { display: block; }
  .letter { border: 0; box-shadow: none; padding: 0; min-height: 0; }
}

/* ---------- quick log (timesheet) ---------- */
.ql-form { background: #fbfcfa; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-bottom: .9rem; }
.ql-title { font-size: .98rem; margin-bottom: .5rem; }
.ql-row { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .ql-row { grid-template-columns: 170px 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; align-items: center; }
.chip { padding: .45rem .8rem; border-radius: 999px; border: 1px solid #c9d3cc; background: #fff; color: var(--forest); font-weight: 600; font-size: .92rem; min-width: 3.2rem; }
.chip.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.dur-input { width: 7.5rem; padding: .45rem .6rem; border-radius: 999px; font-size: .92rem; }
.ql-more { border-top: 0; margin-top: .5rem; padding-top: 0; }
.ql-more summary { font-weight: 500; font-size: .88rem; color: var(--muted); }
.ql-list li.ql-item { display: flex; align-items: center; gap: .6rem; }
.ql-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ql-time { font-weight: 700; color: var(--forest); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ql-actions { flex-wrap: nowrap; gap: .3rem; }
.icon-btn { background: #fff; border: 1px solid var(--line); color: var(--red); width: 2rem; height: 2rem; padding: 0; border-radius: 8px; font-size: 1.2rem; line-height: 1; }
.ql-total { display: flex; justify-content: space-between; padding: .6rem 0 0; border-top: 2px solid var(--line); margin-top: .2rem; color: var(--forest); }
.ql-empty { text-align: center; padding: .6rem 0; }
@media (max-width: 760px) { .chip { flex: 1 0 calc(25% - .4rem); } .dur-input { flex: 1 0 100%; width: 100%; } }

/* ---------- offline bar ---------- */
.netbar { position: sticky; top: calc(env(safe-area-inset-top) + 46px); z-index: 9; background: var(--blue-soft); color: #173f66; padding: .55rem 1rem; font-size: .9rem; text-align: center; border-bottom: 1px solid #c9daee; }
.netbar.off { background: #fdf3d8; color: #5c4300; border-bottom-color: #ecd9a4; }
.netbar.bad { background: var(--red-soft); color: #7d1a14; border-bottom-color: #efc7c3; text-align: left; }
.netbar .link-btn { padding: 0 .3rem; font-weight: 600; }
.netbar-problems ul { margin: .3rem 0; padding-left: 1.2rem; }
@media (min-width: 761px) { .netbar { top: 56px; } }

/* ---------- calendar ---------- */
.cal-filters { margin: .2rem 0 .8rem; }
.cal-close { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .6rem; }
.cal-layout { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .cal-layout { grid-template-columns: 1fr 320px; align-items: start; } .cal-detail { position: sticky; top: 70px; } }
.cal-card { padding: .6rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: .2rem 0; }
.cal-day { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 96px; padding: 5px; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 400; cursor: pointer; color: var(--ink); min-width: 0; }
.cal-day:hover { border-color: var(--green); }
.cal-day.off { background: #f4f6f3; }
.cal-day.today .cal-num { background: var(--forest); color: #fff; }
.cal-day.sel { outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold); }
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.cal-num { font-weight: 700; font-size: .85rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.cal-hours { font-size: .7rem; font-weight: 700; padding: 0 .35rem; border-radius: 99px; background: #eef1ef; color: var(--muted); white-space: nowrap; }
.cal-hours.ok { background: var(--green-soft); color: var(--green); }
.cal-hours.sent { background: var(--blue-soft); color: var(--blue); }
.cal-hours.back { background: var(--red-soft); color: var(--red); }
.cal-hours.team { background: var(--gold-soft); color: var(--gold-dark); }
.cal-chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-chip { display: block; font-size: .7rem; line-height: 1.35; padding: 1px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-chip.hol { background: var(--blue-soft); color: var(--blue); }
.cal-chip.away { background: #f3e8fb; color: #6a2c91; }
.cal-chip.wfh { background: #e6f4f4; color: #1f6b6b; }
.cal-chip.pending { border: 1px dashed currentColor; background: #fff; }
.cal-chip.task.todo { background: var(--amber-soft); color: var(--amber); }
.cal-chip.task.late { background: var(--red-soft); color: var(--red); }
.cal-chip.task.done { background: var(--green-soft); color: var(--green); text-decoration: line-through; }
.cal-more { font-size: .68rem; color: var(--muted); padding-left: 4px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .78rem; color: var(--muted); padding: .6rem .3rem .1rem; }
.cal-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.away { background: #9b59c6; } .dot.wfh { background: #2a9090; } .dot.hol { background: var(--blue); }
.dot.todo { background: #e0a100; } .dot.late { background: var(--red); } .dot.done { background: var(--green); }
.cal-detail h3 { margin-top: .8rem; font-size: .95rem; }
@media (max-width: 760px) {
  .cal-card { padding: .35rem; }
  .cal-grid { gap: 2px; }
  .cal-day { min-height: 58px; padding: 3px 2px; border-radius: 6px; align-items: center; }
  .cal-top { flex-direction: column; gap: 1px; }
  .cal-num { font-size: .8rem; width: 1.4rem; height: 1.4rem; }
  .cal-hours { font-size: .6rem; padding: 0 .2rem; }
  .cal-chips { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 2px; }
  .cal-chip { font-size: 0; width: 7px; height: 7px; padding: 0; border-radius: 50%; border: 0; }
  .cal-chip.hol { background: var(--blue); } .cal-chip.away { background: #9b59c6; } .cal-chip.wfh { background: #2a9090; }
  .cal-chip.pending { background: #c9a9de; border: 0; }
  .cal-chip.task.todo { background: #e0a100; } .cal-chip.task.late { background: var(--red); } .cal-chip.task.done { background: var(--green); }
  .cal-more { display: none; }
  .cal-head { font-size: .65rem; }
}
.cal-filters .chip { flex: 0 1 auto; }

/* ---------- org chart ---------- */
.org-wrap { overflow-x: auto; }
.org-tree { min-width: max-content; padding: .5rem 0 .2rem; }
.org-tree ul { position: relative; display: flex; justify-content: center; margin: 0; padding: 22px 0 0; }
.org-tree > ul { padding-top: 0; }
.org-tree li { list-style: none; position: relative; padding: 22px 8px 0; display: flex; flex-direction: column; align-items: center; }
.org-tree > ul > li { padding-top: 0; }
.org-tree li::before, .org-tree li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid #c9d3cc; }
.org-tree li::after { right: auto; left: 50%; border-left: 2px solid #c9d3cc; }
.org-tree li:only-child::before, .org-tree li:only-child::after { display: none; }
.org-tree li:only-child { padding-top: 0; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border: 0 none; }
.org-tree li:last-child::before { border-right: 2px solid #c9d3cc; border-radius: 0 8px 0 0; }
.org-tree li:first-child::after { border-radius: 8px 0 0 0; }
.org-tree > ul > li::before, .org-tree > ul > li::after { display: none; }
.org-tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid #c9d3cc; }
.org-tree li:only-child > .org-card { margin-top: 0; }
.org-card { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: 10px; padding: .6rem .8rem; min-width: 170px; max-width: 220px; text-align: center; box-shadow: var(--shadow); }
.org-card.top { border-top-color: var(--gold); }
.org-card.me { outline: 2px solid var(--gold); outline-offset: 1px; }
.org-name { font-weight: 700; color: var(--forest); }
.org-role { font-size: .88rem; color: var(--ink); margin: .1rem 0 .35rem; }
.org-badges { display: flex; gap: .25rem; justify-content: center; flex-wrap: wrap; }
.org-edit select { min-width: 160px; }
.icon-btn.plain { color: var(--forest); }
@media (max-width: 760px) {
  .org-tree { min-width: 0; }
  .org-tree ul { display: block; padding: 0 0 0 1.1rem; border-left: 2px solid #c9d3cc; margin-left: .7rem; }
  .org-tree > ul { border-left: 0; margin-left: 0; padding-left: 0; }
  .org-tree li { display: block; padding: .5rem 0 0; }
  .org-tree li::before, .org-tree li::after, .org-tree ul ul::before { display: none; }
  .org-card { max-width: none; text-align: left; }
  .org-badges { justify-content: flex-start; }
}
.inline-edit { display: flex; gap: .4rem; align-items: center; } .inline-edit input { flex: 1; min-width: 0; } .inline-edit button { white-space: nowrap; }
