/* McConnell Photography — client dashboard */

:root {
  --warm: #FAF7F2;
  --paper: #FFFDF9;
  --cream: #F3EDE3;
  --cream-2: #EDE5D8;
  --stone: #DDD4C7;
  --stone-2: #C9BEAE;
  --sage: #8A9A7E;
  --sage-deep: #5D6D53;
  --sage-wash: #E7ECE1;
  --charcoal: #2F2E2C;
  --ink: #2F2E2C;
  --ink-2: #625D56;
  --ink-3: #8D867C;
  --brown: #8B6B4E;
  --danger: #A04B3C;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(47, 46, 44, .05), 0 6px 24px rgba(47, 46, 44, .06);
  --shadow-lg: 0 10px 40px rgba(47, 46, 44, .18);
  --row-h: 46px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--warm);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sage-deep); }
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--stone);
  background: var(--paper); color: var(--ink);
  font-weight: 500; font-size: 14px; letter-spacing: .01em;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--cream); border-color: var(--stone-2); }
.btn-primary { background: var(--charcoal); border-color: var(--charcoal); color: var(--cream); }
.btn-primary:hover { background: #45433F; border-color: #45433F; }
.btn-sage { background: var(--sage-deep); border-color: var(--sage-deep); color: #fff; }
.btn-sage:hover { background: #4E5D45; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--cream); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--cream); color: var(--ink); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Sign-in ---------- */
.auth-page {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--sage-wash), transparent 60%), var(--warm);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--paper); border: 1px solid var(--stone);
  border-radius: 18px; padding: 40px 36px; box-shadow: var(--shadow);
}
.auth-eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--sage-deep); }
.auth-card h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.1; margin: 0 0 10px; }
.auth-lede { color: var(--ink-2); margin: 0 0 24px; }
.auth-card form { display: grid; gap: 16px; }
.auth-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.auth-card input[type=password] {
  height: 46px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--stone); background: #fff; font-size: 16px;
}
.auth-card .btn { height: 46px; justify-content: center; margin-top: 6px; font-size: 15px; }
.auth-error { background: #F6E5E0; color: var(--danger); padding: 10px 14px; border-radius: 10px; margin: 0 0 18px; font-size: 14px; }

/* ---------- App shell ---------- */
.boot { padding: 80px; text-align: center; color: var(--ink-3); font-family: var(--serif); font-size: 22px; }

.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--charcoal); color: #E9E2D6;
  display: flex; flex-direction: column; padding: 26px 18px 18px;
}
.brand { padding: 0 10px 26px; border-bottom: 1px solid rgba(233, 226, 214, .12); }
.brand-mark { font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1; letter-spacing: .01em; color: #F6F0E6; }
.brand-sub { margin-top: 6px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #A9B59F; }
.nav { display: grid; gap: 2px; margin-top: 20px; }
.nav-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #8E877C; padding: 14px 10px 6px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; color: #DCD4C7; text-align: left;
  padding: 9px 10px; border-radius: 8px; font-size: 14px;
}
.nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav button.active { background: rgba(138, 154, 126, .22); color: #fff; }
.nav button .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.nav button .count { margin-left: auto; font-size: 12px; color: #9A9387; }
.nav svg { width: 17px; height: 17px; opacity: .85; }
.sidebar-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 16px; border-top: 1px solid rgba(233, 226, 214, .12); }

.main { min-width: 0; padding: 28px 32px 120px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-title { font-family: var(--serif); font-weight: 500; font-size: 44px; line-height: 1; margin: 0; letter-spacing: -.005em; }
.page-sub { margin: 8px 0 0; color: var(--ink-2); font-size: 14px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.mobile-menu { display: none; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin: 26px 0 22px; }
.stat-year { border-left: 3px solid var(--sage); }
.stat {
  background: var(--paper); border: 1px solid var(--stone); border-radius: var(--radius);
  padding: 16px 18px; min-width: 0;
}
.stat-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.stat-value { font-family: var(--serif); font-size: 30px; line-height: 1.1; margin-top: 6px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-note { font-size: 13px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.is-alert .stat-value { color: var(--brown); }
button.stat { text-align: left; cursor: pointer; }
button.stat:hover { border-color: var(--stone-2); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; min-width: 260px; flex: 0 1 340px;
  background: var(--paper); border: 1px solid var(--stone); border-radius: 999px;
}
.search svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; }
.select-pill {
  height: 38px; padding: 0 34px 0 14px; border-radius: 999px;
  border: 1px solid var(--stone); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23625D56' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none; font-size: 14px;
}
.toolbar .spacer { flex: 1; }

/* ---------- Groups ---------- */
.group { margin-bottom: 34px; --g: var(--sage); }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 40px; }
.group-head .chev { color: var(--g); transition: transform .15s; }
.group.is-collapsed .group-head .chev { transform: rotate(-90deg); }
.group-name {
  font-family: var(--serif); font-weight: 600; font-size: 27px; line-height: 1.1;
  color: var(--g); margin: 0; padding: 2px 6px; border-radius: 6px;
  border: 1px solid transparent; background: transparent; min-width: 40px; cursor: text;
}
.group-name:hover { border-color: var(--stone); }
input.group-name { outline: 0; border-color: var(--stone-2); background: #fff; width: auto; }
.group-count { color: var(--ink-3); font-size: 13px; }
.inbox-tag {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--sage-wash); color: var(--sage-deep);
  padding: 3px 9px; border-radius: 999px; font-weight: 500;
}
.group-head .icon-btn.menu { opacity: .0; }
.group-head:hover .icon-btn.menu, .group-head .icon-btn.menu:focus-visible, .group-head .icon-btn.menu[aria-expanded=true] { opacity: 1; }

.table-wrap {
  background: var(--paper); border: 1px solid var(--stone);
  border-radius: var(--radius); overflow-x: auto; overflow-y: hidden;
  box-shadow: 0 1px 1px rgba(47, 46, 44, .03);
}
.group.is-collapsed .table-wrap { display: none; }
.group.is-collapsed .collapsed-summary { display: flex; }
.collapsed-summary {
  display: none; align-items: center; gap: 18px; padding: 12px 16px;
  border: 1px solid var(--stone); border-left: 5px solid var(--g);
  border-radius: var(--radius); background: var(--paper); color: var(--ink-2); font-size: 14px;
}

table.board { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 1140px; table-layout: fixed; }
.board th {
  text-align: left; font-weight: 500; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 12px; height: 40px; border-bottom: 1px solid var(--stone);
  background: var(--paper); white-space: nowrap;
}
.board th.num, .board td.num { text-align: right; }
.board th.center, .board td.center { text-align: center; }
.board td {
  height: var(--row-h); padding: 0 12px; border-bottom: 1px solid var(--cream-2);
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.board tbody tr { background: var(--paper); transition: background .1s; }
.board tbody tr:hover { background: #FBF8F3; }
.board tbody tr.is-open { background: var(--sage-wash); }
.board td.edge { width: 6px; padding: 0; background: var(--g); border-bottom-color: var(--g); }
.board th.edge { width: 6px; padding: 0; background: var(--g); border-bottom-color: var(--g); }
.board tfoot td.edge { background: color-mix(in srgb, var(--g) 45%, transparent); }
.col-drag { width: 30px; padding: 0 !important; }
.drag-handle {
  display: grid; place-items: center; width: 30px; height: var(--row-h);
  color: var(--stone-2); cursor: grab; opacity: 0;
}
tr:hover .drag-handle { opacity: 1; }
.drag-handle svg { width: 14px; height: 14px; }
.col-title { width: auto; }
.cell-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cell-title .title-btn {
  border: 0; background: transparent; padding: 4px 0; text-align: left; font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink);
}
.cell-title .title-btn:hover { color: var(--sage-deep); text-decoration: underline; text-underline-offset: 3px; }
.new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brown); flex: none; box-shadow: 0 0 0 3px rgba(139, 107, 78, .15); }
.meta-icons { margin-left: auto; display: flex; gap: 8px; color: var(--ink-3); font-size: 12px; flex: none; }
.meta-icons span { display: inline-flex; align-items: center; gap: 3px; }
.meta-icons svg { width: 14px; height: 14px; }
.col-status { width: 148px; }
.col-date { width: 154px; }
.col-type { width: 100px; }
.col-pkg { width: 100px; }
.col-loc { width: 132px; }
.col-money { width: 86px; }
.col-pay { width: 120px; }

/* Label pills fill the cell like Monday, softened. */
td.pill-cell { padding: 5px 6px; }
.pill {
  display: block; text-align: center; line-height: 34px;
  width: 100%; height: 34px; padding: 0 10px; border-radius: 7px; border: 0;
  font-size: 13px; font-weight: 500; letter-spacing: .01em;
  background: var(--pill, #EEE8DE); color: var(--pill-ink, var(--ink-3));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: filter .12s, transform .12s;
}
.pill:hover { filter: brightness(.96); }
.pill.is-empty { background: #F5F0E8; color: var(--stone-2); }
.pill-inline { display: inline-block; width: auto; max-width: 100%; height: 28px; line-height: 28px; padding: 0 12px; border-radius: 999px; }

/* Inline-editable cells */
.cell-input {
  width: 100%; height: 34px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; padding: 0 8px; font-size: 14px; color: var(--ink); min-width: 0;
}
.cell-input:hover { border-color: var(--stone); background: #fff; }
.cell-input:focus { border-color: var(--sage); background: #fff; outline: 0; }
.cell-input.num { text-align: right; }
.cell-input::placeholder { color: var(--stone-2); }
input[type=date].cell-input, input[type=time].cell-input { font-variant-numeric: tabular-nums; }
input[type=date].cell-input:invalid, input[type=date].cell-input[value=""] { color: var(--stone-2); }
.date-soon { color: var(--brown); font-weight: 500; }
.date-past { color: var(--ink-3); }
.cell-text { color: var(--ink-2); padding: 0 8px; }
.cell-muted { color: var(--stone-2); padding: 0 8px; }

/* Add row + summary */
.board tr.add-row td { border-bottom: 1px solid var(--stone); height: 44px; }
.add-input {
  width: 100%; border: 1px dashed transparent; border-radius: 7px; height: 32px; padding: 0 8px;
  background: transparent; color: var(--ink-2); font-size: 14px;
}
.add-input::placeholder { color: var(--ink-3); }
.add-input:hover { border-color: var(--stone); }
.add-input:focus { border-color: var(--sage); border-style: solid; background: #fff; outline: 0; }
.board tr.summary td { height: 50px; border-bottom: 0; background: #FCFAF6; }
.sum-value { font-weight: 500; font-variant-numeric: tabular-nums; }
.sum-label { display: block; font-size: 11px; color: var(--ink-3); letter-spacing: .05em; }
.dist { display: flex; height: 20px; border-radius: 5px; overflow: hidden; background: #F5F0E8; }
.dist span { display: block; height: 100%; }

/* Empty group */
.empty-group td { height: 60px; color: var(--ink-3); font-style: italic; font-family: var(--serif); font-size: 18px; }

/* Drag & drop */
tr.dragging { opacity: .4; }
tr.drop-before td { box-shadow: inset 0 2px 0 var(--sage); }
tr.drop-after td { box-shadow: inset 0 -2px 0 var(--sage); }
.table-wrap.drop-target { border-color: var(--sage); box-shadow: 0 0 0 3px var(--sage-wash); }

.add-group {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 56px; border: 1.5px dashed var(--stone-2); border-radius: var(--radius);
  background: transparent; color: var(--ink-2); font-weight: 500;
}
.add-group svg { width: 18px; height: 18px; }
.add-group:hover { border-color: var(--sage); color: var(--sage-deep); background: var(--sage-wash); }

/* ---------- Popovers & menus ---------- */
.popover {
  position: fixed; z-index: 60; min-width: 220px; max-width: 320px;
  background: var(--paper); border: 1px solid var(--stone); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 8px;
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.popover .pill { margin-bottom: 5px; height: 32px; line-height: 32px; }
.popover .pill.is-current { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--charcoal); }
.popover-foot { border-top: 1px solid var(--cream-2); margin-top: 6px; padding-top: 6px; display: flex; justify-content: space-between; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; text-align: left; font-size: 14px;
}
.menu-item:hover { background: var(--cream); }
.menu-item.danger { color: var(--danger); }
.menu-item svg { width: 16px; height: 16px; color: var(--ink-3); }
.menu-sep { height: 1px; background: var(--cream-2); margin: 6px 0; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; padding: 6px 4px; }
.swatch { width: 26px; height: 26px; border-radius: 7px; border: 0; background: var(--c); }
.swatch.is-current { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--charcoal); }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(47, 46, 44, .28); z-index: 40; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(640px, 100vw); background: var(--warm);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slide .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { padding: 18px 24px 0; background: var(--paper); border-bottom: 1px solid var(--stone); }
.drawer-top { display: flex; align-items: center; gap: 8px; }
.drawer-top .group-select {
  height: 30px; border-radius: 999px; border: 1px solid var(--stone); padding: 0 28px 0 26px; font-size: 13px;
  appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23625D56' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  max-width: 220px;
}
.group-select-wrap { position: relative; display: inline-flex; align-items: center; }
.group-select-wrap::before { content: ""; position: absolute; left: 11px; width: 8px; height: 8px; border-radius: 3px; background: var(--g); pointer-events: none; }
.save-state { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.drawer-title {
  width: 100%; margin: 12px 0 4px; border: 1px solid transparent; border-radius: 8px; background: transparent;
  font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.15; padding: 2px 6px; margin-left: -6px;
}
.drawer-title:hover { border-color: var(--stone); }
.drawer-title:focus { border-color: var(--sage); background: #fff; outline: 0; }
.drawer-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--ink-2); font-size: 13px; margin-bottom: 14px; }
.drawer-sub .pill { width: auto; }
.tabs { display: flex; gap: 22px; }
.tab {
  border: 0; background: transparent; padding: 10px 0 12px; font-size: 14px; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab[aria-selected=true] { color: var(--ink); border-bottom-color: var(--charcoal); }
.tab .badge { font-size: 11px; background: var(--cream-2); color: var(--ink-2); padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }

.new-banner {
  display: flex; gap: 12px; align-items: flex-start;
  background: #F5EEE6; border: 1px solid #E6D6C4; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px; font-size: 14px;
}
.new-banner svg { width: 18px; height: 18px; color: var(--brown); flex: none; margin-top: 1px; }

.section { background: var(--paper); border: 1px solid var(--stone); border-radius: var(--radius); padding: 16px 18px 18px; margin-bottom: 16px; }
.section h3 {
  margin: 0 0 14px; font-family: var(--serif); font-weight: 600; font-size: 21px; display: flex; align-items: center; gap: 8px;
}
.section h3 .aside { margin-left: auto; font-family: var(--sans); font-weight: 400; font-size: 13px; color: var(--ink-2); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.fields .full { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--ink-2); letter-spacing: .02em; }
.field input, .field select, .field textarea {
  width: 100%; height: 40px; border: 1px solid var(--stone); border-radius: 8px; background: #fff; padding: 0 12px; font-size: 14px; min-width: 0;
}
.field textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--sage); outline: 0; box-shadow: 0 0 0 3px var(--sage-wash); }
.input-with-action { display: flex; gap: 6px; }
.input-with-action .icon-btn { width: 40px; height: 40px; border: 1px solid var(--stone); background: #fff; flex: none; }
.input-with-action .icon-btn:hover { background: var(--cream); }
.money-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.balance { display: grid; gap: 5px; }
.balance > span { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.balance strong { height: 40px; display: flex; align-items: center; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.balance strong.owed { color: var(--brown); }
.message-box { white-space: pre-wrap; background: var(--cream); border-radius: 8px; padding: 12px 14px; font-size: 14px; color: var(--ink); }

.custom-row { display: grid; grid-template-columns: 1fr 1.6fr 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.custom-row input { height: 38px; border: 1px solid var(--stone); border-radius: 8px; background: #fff; padding: 0 10px; font-size: 14px; min-width: 0; }
.custom-row input:focus { border-color: var(--sage); outline: 0; }

.drawer-danger { display: flex; gap: 10px; justify-content: space-between; margin-top: 8px; }

/* Notes / activity */
.note-compose { background: var(--paper); border: 1px solid var(--stone); border-radius: var(--radius); padding: 12px; margin-bottom: 20px; }
.note-compose textarea { width: 100%; min-height: 80px; border: 0; resize: vertical; outline: 0; background: transparent; font-size: 14px; line-height: 1.5; }
.note-compose .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.note-compose .hint { font-size: 12px; color: var(--ink-3); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { position: relative; }
.note-card { background: var(--paper); border: 1px solid var(--stone); border-radius: var(--radius); padding: 12px 14px; }
.note-card .body { white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }
.note-card.is-email { border-left: 3px solid var(--sage); }
.note-card.is-email .body { max-height: 320px; overflow-y: auto; }
.note-card .meta { display: flex; align-items: center; justify-content: space-between; color: var(--ink-3); font-size: 12px; margin-bottom: 6px; }
.sys-line { font-size: 13px; color: var(--ink-3); padding: 2px 14px; display: flex; gap: 8px; align-items: center; }
.sys-line::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--stone-2); flex: none; }
.sys-line time { margin-left: auto; white-space: nowrap; }

/* Files */
.dropzone {
  border: 1.5px dashed var(--stone-2); border-radius: var(--radius); background: var(--paper);
  padding: 26px; text-align: center; color: var(--ink-2); margin-bottom: 18px; transition: background .15s, border-color .15s;
}
.dropzone.is-over { border-color: var(--sage); background: var(--sage-wash); }
.dropzone strong { display: block; font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.dropzone .btn { margin-top: 12px; }
.file-list { display: grid; gap: 8px; }
.file {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  background: var(--paper); border: 1px solid var(--stone); border-radius: var(--radius); padding: 8px 10px 8px 8px;
}
.file-thumb {
  width: 44px; height: 44px; border-radius: 8px; background: var(--cream); display: grid; place-items: center;
  font-size: 10px; font-weight: 600; color: var(--brown); letter-spacing: .06em; text-transform: uppercase; overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-name { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); text-decoration: none; display: block; }
.file-name:hover { text-decoration: underline; }
.file-meta { font-size: 12px; color: var(--ink-3); }
.file-actions { display: flex; gap: 2px; }
.empty-state { text-align: center; color: var(--ink-3); font-family: var(--serif); font-size: 19px; padding: 20px; font-style: italic; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; z-index: 70; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--warm); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: pop .15s ease-out;
}
.modal.small { width: min(440px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 20px 24px 0; }
.modal-head h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 30px; }
.modal-head .icon-btn { margin-left: auto; }
.modal .tabs { padding: 10px 24px 0; border-bottom: 1px solid var(--stone); }
.modal-body { padding: 20px 24px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }
.modal p { color: var(--ink-2); }

.label-editor { display: grid; gap: 8px; margin-bottom: 14px; }
.label-row { display: grid; grid-template-columns: 34px 1fr 32px 32px 32px; gap: 6px; align-items: center; }
.label-row .swatch-btn { width: 34px; height: 34px; border-radius: 8px; border: 0; background: var(--c); }
.label-row input { height: 38px; border: 1px solid var(--stone); border-radius: 8px; padding: 0 10px; background: #fff; min-width: 0; }
.label-row input:focus { border-color: var(--sage); outline: 0; }
.label-row .icon-btn:disabled { opacity: .25; cursor: default; }

.codeblock {
  position: relative; background: var(--charcoal); color: #EDE5D8; border-radius: 10px;
  padding: 14px 16px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55;
  white-space: pre; overflow-x: auto; margin: 8px 0 16px;
}
.codeblock .copy { position: absolute; top: 8px; right: 8px; height: 28px; font-size: 12px; background: rgba(255,255,255,.1); color: #fff; border-color: transparent; }
.codeblock .copy:hover { background: rgba(255,255,255,.18); }
.kv { display: grid; gap: 6px; margin-bottom: 14px; }
.kv > span { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.kv .input-with-action input { flex: 1; height: 40px; border: 1px solid var(--stone); border-radius: 8px; padding: 0 12px; background: #fff; font-family: ui-monospace, Menlo, monospace; font-size: 13px; min-width: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90;
  background: var(--charcoal); color: var(--cream); padding: 11px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .15s; display: flex; gap: 12px; align-items: center;
}
.toast.error { background: var(--danger); color: #fff; }
.toast button { border: 0; background: transparent; color: #CFE0C4; font-weight: 500; padding: 0; }

/* ---------- Upcoming view ---------- */
.agenda { display: grid; gap: 26px; }
.agenda-month h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 0 0 10px; color: var(--sage-deep); }
.agenda-list { background: var(--paper); border: 1px solid var(--stone); border-radius: var(--radius); overflow: hidden; }
.agenda-row {
  display: grid; grid-template-columns: 70px 1fr auto; gap: 16px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--cream-2); width: 100%; border-left: 0; border-right: 0; border-top: 0;
  background: transparent; text-align: left;
}
.agenda-row:last-child { border-bottom: 0; }
.agenda-row:hover { background: #FBF8F3; }
.agenda-date { text-align: center; line-height: 1; }
.agenda-date .d { font-family: var(--serif); font-size: 30px; font-weight: 600; display: block; }
.agenda-date .w { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.agenda-what { min-width: 0; }
.agenda-what strong { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-what span { font-size: 13px; color: var(--ink-2); }
.agenda-kind { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--cream-2); color: var(--ink-2); }
.agenda-kind.meeting { background: #E5EBF0; color: #4F6475; }

/* ---------- Responsive ---------- */
@media (max-width: 1599px) {
  .stats { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .stats > .stat:nth-child(-n+3) { grid-column: span 4; }
  .stats > .stat:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > .stat:nth-child(n) { grid-column: auto; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; width: 270px;
    transform: translateX(-100%); transition: transform .2s;
  }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .mobile-menu { display: inline-grid; }
  .main { padding: 18px 16px 100px; }
  .page-title { font-size: 34px; }
  .topbar { align-items: center; }
  .topbar-left { display: flex; align-items: center; gap: 8px; }
  .search { min-width: 0; flex: 1 1 100%; }
  .stat-value { font-size: 28px; }
  .fields { grid-template-columns: 1fr; }
  .money-strip { grid-template-columns: 1fr 1fr; }
  .drawer-body { padding: 18px 16px 40px; }
  .drawer-head { padding: 14px 16px 0; }
  .group-head .icon-btn.menu { opacity: 1; }
  .drag-handle { opacity: 1; }
}
@media (max-width: 520px) {
  .topbar-actions .btn span { display: none; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Small-screen group headers */
.inbox-tag, .group-count { white-space: nowrap; }
@media (max-width: 520px) {
  .group-head { flex-wrap: wrap; row-gap: 2px; }
  .group-name { font-size: 24px; }
  .inbox-tag { display: none; }
}
