/* Iron Code CRM, laid out like Contacts on a Mac: a sidebar of lists, a quiet
   list of names, and the person in frosted glass over a soft gradient.
   Sizes follow the Mac app at its own scale, not a web-app scale. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;

  --pane: #ffffff;
  --side: #f5f5f7;
  --text: #1d1d1f;
  --muted: #8a8a8e;
  --hair: rgba(60, 60, 67, 0.14);
  --field: rgba(118, 118, 128, 0.12);
  --hover: rgba(0, 0, 0, 0.045);
  --select: #3a87f5;
  --accent: #0a7aff;
  --avatar-a: #b6bddb;
  --avatar-b: #8a93c4;
  --shadow: 0 0 0 0.5px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .08);

  --sky-a: #adb9cc;
  --sky-b: #8f95c6;
  --sky-c: #4e4f8c;
  --glass: rgba(255, 255, 255, 0.17);
  --glass-hi: rgba(255, 255, 255, 0.27);
  --glass-rim: rgba(255, 255, 255, 0.38);
  --on: #ffffff;
  --on-dim: rgba(255, 255, 255, 0.74);
  --dot: #a8b3ff;

  --business: #3a87f5;
  --personal: #e0529c;
  --both: #8b5cf6;
  --unsorted: #8e8e93;
  --due: #ff9f0a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pane: #1e1e1f; --side: #262628; --text: #f5f5f7; --muted: #98989d;
    --hair: rgba(255, 255, 255, 0.10); --field: rgba(118, 118, 128, 0.26); --hover: rgba(255, 255, 255, .06);
    --avatar-a: #6e7497; --avatar-b: #4d5279;
    --shadow: 0 0 0 0.5px rgba(255, 255, 255, .12), 0 2px 8px rgba(0, 0, 0, .4);
    --sky-a: #3c4462; --sky-b: #2f315c; --sky-c: #1b1a3a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.35 var(--font); color: var(--text); background: var(--pane); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.f { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }
.grow { flex: 1; }

.app { display: grid; grid-template-columns: 220px minmax(300px, 380px) 1fr; height: 100vh; }
.app.no-side { grid-template-columns: 0 minmax(300px, 420px) 1fr; }
.app.no-side .side { visibility: hidden; }
.round.show-side { display: none; }
.app.no-side .round.show-side { display: grid; }

.round {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: var(--text); background: var(--pane); border: 0; box-shadow: var(--shadow);
}
.round:hover { background: var(--field); }

/* ---- sidebar ---- */
.side { display: flex; flex-direction: column; background: var(--side); border-right: 1px solid var(--hair); overflow: hidden; }
.side-top { display: flex; padding: 12px 14px; }
#lists { flex: 1; overflow-y: auto; padding: 4px 10px; }
.group { margin: 14px 8px 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
.li {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 7px;
  background: none; cursor: pointer; text-align: left; font-size: 13px;
}
.li:hover { background: var(--hover); }
.li[aria-current="true"] { background: var(--field); font-weight: 600; }
.li i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; margin: 0 4px; }
.li svg.i { color: var(--accent); width: 16px; height: 16px; }
.li span { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 400; }
.side-foot { padding: 10px; border-top: 1px solid var(--hair); }
.side-link { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; text-decoration: none; color: var(--muted); }
.side-link:hover { background: var(--hover); color: var(--text); }
.side-link span { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- list ---- */
.list { display: flex; flex-direction: column; min-height: 0; background: var(--pane); border-right: 1px solid var(--hair); position: relative; }
.list-top { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.list-top h1 { flex: 1; margin: 0; font: 700 15px/1 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 38px; z-index: 20; min-width: 190px; padding: 5px; border-radius: 10px;
  background: color-mix(in srgb, var(--pane) 86%, transparent); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, .15), 0 10px 30px rgba(0, 0, 0, .18);
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 10px 5px 24px; border-radius: 5px; cursor: pointer; position: relative; }
.menu button[aria-checked="true"]::before { content: "✓"; position: absolute; left: 8px; }
.menu button:hover { background: var(--accent); color: #fff; }

.search { margin: 2px 12px 6px; display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 18px; background: var(--field); color: var(--muted); }
.search svg.i { width: 15px; height: 15px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 13px; }

.list-body { flex: 1; min-height: 0; position: relative; }
.rows { position: absolute; inset: 0; overflow-y: auto; padding: 0 22px 20px 10px; scrollbar-width: thin; }
.letter { position: sticky; top: 0; z-index: 1; padding: 10px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--pane); border-bottom: 1px solid var(--hair); }
.row {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; height: 48px;
  padding: 0 10px; border: 0; background: none; cursor: pointer; border-radius: 8px;
}
.row .name {
  flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--hair); font-size: 13px; white-space: nowrap; overflow: hidden;
}
.row .name > b { font-weight: 600; }
.row .name .n { overflow: hidden; text-overflow: ellipsis; }
.row .due { width: 7px; height: 7px; border-radius: 50%; background: var(--due); flex: none; margin-left: auto; margin-right: 4px; }
.row:hover { background: var(--hover); }
.row[aria-selected="true"] { background: var(--select); color: #fff; }
.row[aria-selected="true"] .name { border-color: transparent; }
.av {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font: 500 15px/1 var(--display); color: #fff;
  background: linear-gradient(170deg, var(--avatar-a), var(--avatar-b));
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, .5);
}
.index { position: absolute; right: 2px; top: 6px; bottom: 6px; width: 18px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; }
.index button { border: 0; background: none; padding: 0; cursor: pointer; font-size: 9px; font-weight: 700; color: var(--accent); line-height: 1; }
.index button:disabled { color: var(--muted); opacity: .4; cursor: default; }
.count { padding: 6px 14px 8px; font-size: 11px; color: var(--muted); text-align: center; border-top: 1px solid var(--hair); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---- person ---- */
.card {
  position: relative; overflow-y: auto; color: var(--on); min-width: 0;
  background: linear-gradient(180deg, var(--sky-a) 0%, var(--sky-b) 52%, var(--sky-c) 100%);
}
.card-top { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
#card-actions { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 16px; border-radius: 16px; cursor: pointer;
  color: var(--on); background: var(--glass); border: 0.5px solid var(--glass-rim); text-decoration: none;
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  font-size: 13px; font-weight: 500; box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, .5);
}
.pill:hover { background: var(--glass-hi); }
.pill.primary { background: rgba(255, 255, 255, .9); color: var(--sky-c); font-weight: 600; }
.back { display: none; }

.person { width: min(340px, 100% - 32px); margin: 0 auto; padding: 4px 0 40px; }
.big {
  width: 172px; height: 172px; margin: 8px auto 0; border-radius: 50%; display: grid; place-items: center;
  font: 400 86px/1 var(--display); color: #fff; letter-spacing: -0.02em;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255, 255, 255, .30), transparent 70%),
    radial-gradient(120% 120% at 50% 110%, rgba(255, 255, 255, .10), rgba(255, 255, 255, .04) 60%);
  border: 1px solid rgba(255, 255, 255, .42);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, .6), inset 0 -2px 6px rgba(255, 255, 255, .12),
    inset 0 0 0 5px rgba(255, 255, 255, .06), 0 16px 40px rgba(25, 25, 70, .16);
}
.person h2 { margin: 14px 0 2px; text-align: center; font: 700 19px/1.2 var(--display); text-shadow: 0 1px 6px rgba(20, 20, 70, .28); }
.person .sub { text-align: center; color: var(--on-dim); margin: 0; font-size: 13px; min-height: 18px; }
.acts { display: flex; justify-content: center; gap: 10px; margin: 16px 0 18px; }
.act {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: var(--glass); border: 0.5px solid var(--glass-rim); text-decoration: none;
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, .55), 0 2px 8px rgba(20, 20, 70, .08);
}
.act svg.i { width: 18px; height: 18px; }
.act:hover { background: var(--glass-hi); }
.act[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.box {
  margin-bottom: 8px; padding: 9px 14px; border-radius: 13px;
  background: rgba(255, 255, 255, .14); border: 0.5px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
}
.k { display: block; font-size: 11.5px; color: var(--on); opacity: .92; }
.v { display: block; font-size: 13.5px; color: #fff; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.v:hover { text-decoration: underline; text-underline-offset: 2px; }
.line { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.line + .line { margin-top: 6px; padding-top: 6px; border-top: 0.5px solid rgba(255, 255, 255, .2); }
.line .grow { min-width: 0; }
.dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--dot); color: #fff; text-decoration: none; flex: none; }
.dot svg.i { width: 13px; height: 13px; }
.rowbtn { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; font-size: 13.5px; color: #fff; padding: 11px 14px; text-decoration: none; }
.rowbtn:hover { background: rgba(255, 255, 255, .2); }

.kindset { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; padding: 2px; border-radius: 9px; background: rgba(0, 0, 0, .08); }
.kindset button { border: 0; background: none; color: #fff; padding: 5px 2px; border-radius: 7px; cursor: pointer; font-size: 12px; }
.kindset button[aria-pressed="true"] { background: rgba(255, 255, 255, .92); color: var(--sky-c); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.gi { width: 100%; border: 0; outline: 0; background: none; color: #fff; font-size: 13.5px; padding: 1px 0; color-scheme: dark; }
.gi::placeholder { color: var(--on-dim); }
select.gi { appearance: none; cursor: pointer; }
select.gi option { color: #1d1d1f; }
textarea.gi { min-height: 96px; resize: vertical; line-height: 1.45; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two > .box { min-width: 0; }
.gi[type="date"] { min-width: 0; max-width: 100%; }
.foot { color: var(--on-dim); font-size: 11px; text-align: center; margin-top: 14px; }
.none { display: grid; place-items: center; height: calc(100vh - 60px); color: var(--on-dim); font-size: 15px; }
.toast { position: fixed; bottom: 20px; right: 24px; z-index: 30; padding: 7px 14px; border-radius: 16px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; backdrop-filter: blur(10px); }
.toast.on { opacity: 1; }

/* edit mode */
.edit .box.field { padding: 7px 14px; }
.edit .gi { font-size: 13.5px; }
.multi .gi + .gi { margin-top: 6px; padding-top: 6px; border-top: 0.5px solid rgba(255, 255, 255, .2); }
.add { border: 0; background: none; color: #fff; opacity: .85; cursor: pointer; padding: 6px 0 0; font-size: 12.5px; }
.add:hover { opacity: 1; }
.big.small { width: 120px; height: 120px; font-size: 58px; }

/* the empty pane: explainer tiles (Apple feature-tile anatomy) */
.welcome { max-width: 700px; margin: 0 auto; padding: 18vh 24px 40px; text-align: center; }
.none-line { color: var(--on-dim); font-size: 15px; margin: 0 0 28px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 200px)); justify-content: center; gap: 16px; }
.tile {
  aspect-ratio: 1; display: flex; flex-direction: column; text-align: left; padding: 0; border: 0; cursor: pointer; color: #fff;
  border-radius: 11px; overflow: hidden; background: rgba(255, 255, 255, .14);
  border: 0.5px solid rgba(255, 255, 255, .24); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 10px 12px 30px rgba(20, 20, 70, .16); transition: transform .15s, background .15s;
}
.tile:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .2); }
.tile-top { display: flex; align-items: center; gap: 10px; padding: 14px; min-height: 76px; background: rgba(255, 255, 255, .1); }
.tile-top svg.i { width: 26px; height: 26px; }
.tile-top b { display: block; font-size: 15px; font-weight: 600; }
.tile-top small { display: block; font-size: 11.5px; color: var(--on-dim); margin-top: 1px; }
.tile-body { flex: 1; display: flex; align-items: flex-end; padding: 14px; font-size: 12.5px; color: var(--on-dim); line-height: 1.4; }

.scrim-light { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(245, 245, 247, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet { position: relative; width: min(460px, 100%); padding: 36px 36px 28px; border-radius: 11px; background: #fff; color: rgba(0, 0, 0, .88); box-shadow: 0 11px 34px rgba(0, 0, 0, .16); text-align: center; }
.sheet-x { position: absolute; left: 12px; top: 10px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .06); color: rgba(0, 0, 0, .56); font-size: 18px; line-height: 1; cursor: pointer; }
.sheet-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(170deg, var(--sky-a), var(--sky-c)); }
.sheet-icon svg.i { width: 28px; height: 28px; }
.sheet h2 { margin: 0 0 10px; font: 600 21px/1.2 var(--display); }
.sheet p { margin: 0 0 18px; font-size: 14px; line-height: 1.45; color: rgba(0, 0, 0, .56); text-align: left; }
.howto { text-align: left; padding: 12px 14px; border-radius: 11px; background: rgba(120, 120, 128, .08); font-size: 13px; color: rgba(0, 0, 0, .7); margin-bottom: 22px; }
.howto b { display: block; font-size: 12px; color: rgba(0, 0, 0, .88); margin-bottom: 2px; }
.blue { border: 0; border-radius: 8px; padding: 9px 26px; background: #0071e3; color: #fff; font-size: 15px; cursor: pointer; }
.blue:hover { background: #0077ed; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sheet { background: #2c2c2e; color: rgba(255, 255, 255, .92); }
  :root:not([data-theme="light"]) .sheet p, :root:not([data-theme="light"]) .howto { color: rgba(255, 255, 255, .62); }
  :root:not([data-theme="light"]) .howto { background: rgba(255, 255, 255, .06); }
  :root:not([data-theme="light"]) .howto b { color: #fff; }
  :root:not([data-theme="light"]) .scrim-light { background: rgba(0, 0, 0, .45); }
}

/* ---- board ---- */
.board { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); grid-auto-rows: auto 1fr; gap: 12px; padding: 12px 14px 18px; overflow: auto; min-height: 0; background: linear-gradient(180deg, var(--sky-a), var(--sky-c)); }
.app.no-side .board { grid-column: 1 / -1; }
.board-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: #fff; }
.board-top h1 { margin: 0; font: 700 15px/1 var(--display); flex: 1; }
.col { border-radius: 14px; padding: 8px; background: rgba(255, 255, 255, .14); border: 0.5px solid rgba(255, 255, 255, .22); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: #fff; min-height: 0; overflow-y: auto; }
.col h3 { margin: 4px 6px 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; display: flex; justify-content: space-between; opacity: .92; }
.col .row { color: #fff; height: 44px; }
.col .row .name { border-color: rgba(255, 255, 255, .16); }
.col .row:hover { background: rgba(255, 255, 255, .14); }
.col .av { width: 28px; height: 28px; font-size: 12px; }

/* ---- sign-in ---- */
.door { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, var(--sky-a), var(--sky-b) 52%, var(--sky-c)); color: #fff; }
.door .panel { width: min(340px, 100%); text-align: center; }
.door .big { font-size: 58px; font-weight: 500; }
.door h1 { font: 700 22px/1.2 var(--display); margin: 20px 0 4px; }
.door p { color: var(--on-dim); margin: 0 0 24px; font-size: 14px; }
.door .pill { justify-content: center; width: 100%; height: 40px; font-size: 14px; }
.note { margin-top: 14px; font-size: 12.5px; color: #fff; word-break: break-all; padding: 12px 14px; border-radius: 13px; background: rgba(255, 255, 255, .14); }

/* ---- smaller screens ---- */
@media (max-width: 1080px) {
  .app { grid-template-columns: 0 minmax(280px, 360px) 1fr; }
  .app .side { visibility: hidden; }
  .app .round.show-side { display: grid; }
  .app.side-open .side { visibility: visible; position: fixed; left: 0; top: 0; bottom: 0; width: 240px; z-index: 40; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 0 1fr; }
  .card { position: fixed; inset: 0; z-index: 5; }
  .app:not(.open) .card { display: none; }
  .back { display: inline-flex; }
  .row { height: 56px; }
  .row .name { font-size: 16px; }
  .av { width: 40px; height: 40px; font-size: 17px; }
  .search input { font-size: 16px; }
  .v, .gi, .rowbtn { font-size: 16px; }
  .board { grid-column: 1 / -1; grid-template-columns: repeat(5, 82vw); }
  .welcome { padding-top: 10vh; }
  .tiles { grid-template-columns: 1fr; }
  .tile { aspect-ratio: auto; min-height: 120px; }
}
