/* e.co.fo app shell — dash, links, notes.
   Same palette and type as mail.html on purpose: the mailbox is the first room
   of the house, these are the others. */

@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-latin.woff2') format('woff2');
}

:root {
  --ink: #23282a;
  --ink-2: #383b3c;
  --muted: #6e7172;
  --faint: #9a9d9e;
  --line: #e4e8ea;
  --line-soft: #eef1f2;
  --accent: #e7793b;
  --accent-ink: #a34b1d;
  --accent-wash: #fdf3ec;
  --wash: #f6f7f8;
  --sidebar: #202426;
  --sidebar-2: #333637;
  --sidebar-3: #3f4243;
  --ok: #3f7a54;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* `hidden` must win over the display of .btn/.panel — otherwise a button that is
   switched off for a non-admin still draws because .btn sets inline-flex. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid #b65b27; outline-offset: 2px; }
::selection { background: #f7d4bc; }
kbd {
  font-family: inherit; font-size: 10px; padding: 1px 4px; border: 1px solid #c8cbcc;
  border-radius: 3px; color: #707374;
}
svg.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
/* The rail is 208 px on every app page: mail.html owns the numbers and these
   match it line for line (27/16 padding, 46 px wordmark, 32 px avatar). */
.app { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  background: var(--sidebar); color: #cccfd0;
  padding: 27px 16px 0; position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 0; min-width: 0;
}
.brand { padding: 0 12px; }
.brand a { font-family: var(--serif); font-size: 46px; line-height: 1; letter-spacing: -1.5px; color: #f5f7f8; text-decoration: none; }
.brand a:hover { text-decoration: none; }
.brand i { color: var(--accent); font-style: normal; }

.account { margin: 27px 0 20px; padding: 5px 10px; display: flex; gap: 9px; align-items: center; border-radius: 6px; width: 100%; text-align: left; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.account:hover { background: var(--sidebar-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #474a4b; color: #f5f7f8; display: grid; place-items: center; font-size: 13px; font-weight: 500; flex: none; text-transform: uppercase; }
.avatar.has-photo { background-size: cover; background-position: center; color: transparent; }
.account .who { min-width: 0; }
.account b { display: block; font-size: 13px; line-height: 17.5px; font-weight: 500; color: #f5f7f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account small { display: block; font-size: 10px; line-height: 13.5px; color: #b7babb; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account > .ico { margin-left: auto; width: 13px; height: 13px; color: #a9acad; }

.nav-section { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #a8abac; padding: 0 12px; margin: 26px 0 12px; }
.navigation { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 39px; padding: 0 12px;
  border-radius: 6px; color: #c1c4c5; font-size: 13px; text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-3); color: #fff; }
.nav-item .count { margin-left: auto; font-size: 11px; color: #babdbe; font-variant-numeric: tabular-nums; }
.nav-item.active .count { background: #575a5b; color: #fff; border-radius: 4px; padding: 1px 5px; min-width: 22px; text-align: center; }

.sidebar-foot { margin-top: auto; border-top: 1px solid #43464766; height: 56px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: #b3b6b7; }
.sidebar-foot a, .sidebar-foot button { color: #b3b6b7; font-size: 11px; padding: 6px 8px; border-radius: 5px; display: inline-flex; align-items: center; gap: 6px; }
.sidebar-foot a:hover, .sidebar-foot button:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.foot-date { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-gear { flex: none; }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: #7fae8b; box-shadow: 0 0 0 3px rgba(127, 174, 139, .16); }

/* ---------- content ---------- */
/* The rail is fixed at 208 px, so the page is centred inside whatever is left:
   `margin: 0 auto` splits the leftover space evenly instead of letting it pile up
   on the right. Only the block is centred — headings, copy and lists stay
   left-aligned inside it, which is why there is no text-align here. */
.content { padding: 28px clamp(20px, 3.4vw, 44px) 64px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-head .eyebrow { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.page-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -.5px; line-height: 1.2; }
.page-head p { color: var(--muted); font-size: 12.5px; margin-top: 6px; max-width: 56ch; }
.head-actions { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 15px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 12.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
  text-decoration: none;
}
.btn:hover { background: var(--wash); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.solid { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px #d96c3140; }
.btn.solid:hover { background: #d96c31; color: #fff; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--wash); color: var(--ink); }
.btn.danger { color: #a8401f; }
.btn.danger:hover { background: #fdf1ec; border-color: #f0d6c4; }
.btn.sm { height: 29px; padding: 0 11px; font-size: 12px; border-radius: 5px; }

/* ---------- dashboard ---------- */
.who-hello { margin: 26px 0 6px; }
.who-hello h2 { font-size: 20px; font-weight: 500; letter-spacing: -.3px; }
.who-hello p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 12px; margin-top: 22px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; padding: 17px 18px 15px;
  background: #fff; color: inherit; text-decoration: none; overflow: hidden;
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.card:hover { border-color: #cfd6d9; transform: translateY(-2px); box-shadow: 0 8px 22px -14px #23282a55; text-decoration: none; }
.card .top { display: flex; align-items: center; gap: 9px; }
.card .chip { width: 28px; height: 28px; border-radius: 7px; background: var(--wash); color: var(--muted); display: grid; place-items: center; }
.card .chip svg { width: 16px; height: 16px; }
.card .label { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.card .arrow { margin-left: auto; color: #c4c9cb; transition: transform .2s var(--ease), color .2s; }
.card:hover .arrow { color: var(--accent); transform: translateX(2px); }
.card .num { font-size: 27px; font-weight: 600; letter-spacing: -.6px; font-variant-numeric: tabular-nums; margin-top: 12px; line-height: 1.1; }
.card .num small { font-size: 12px; font-weight: 400; color: var(--faint); letter-spacing: 0; margin-left: 4px; }
.card .desc { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.card .meter { height: 4px; border-radius: 99px; background: #eef1f2; margin-top: 12px; overflow: hidden; }
.card .meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.card .meter.ok i { background: #7fae8b; }

.quick { margin-top: 30px; }
.quick h3 { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); font-weight: 500; margin-bottom: 10px; }
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; }

.recent { margin-top: 34px; }
.recent h3 { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); font-weight: 500; margin-bottom: 10px; }
.rows { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.row:last-child { border-bottom: 0; }
.row .k { color: var(--muted); min-width: 120px; flex: none; }
.row .v { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.row .v small { display: block; color: var(--faint); font-size: 11px; }

/* storage meters used inline in a row (status page) and inside cards */
.meter { height: 5px; border-radius: 99px; background: #eceff1; overflow: hidden; flex: 1; min-width: 48px; max-width: 260px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.ok i { background: #7fae8b; }

/* ---------- aliases ----------
   One address per row: picture, the name it writes under, then a quiet number of
   switches. The editor opens underneath instead of in a dialog, so it never
   covers the list it changes. */
.alias-intro { margin-top: 24px; }
.alias-primary, .alias-item {
  display: flex; align-items: center; gap: 14px; padding: 15px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.alias-primary { border: 1px solid var(--line); border-radius: 10px; background: #fbfcfc; }
.alias-list { margin-top: 22px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.alias-item:last-child { border-bottom: 0; }
.alias-item:hover { background: #fbfcfc; }
.alias-ava {
  width: 42px; height: 42px; border-radius: 50%; flex: none; overflow: hidden;
  background: #eef1f2 center/cover no-repeat; color: #6e7172; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 15px; font-weight: 600; text-transform: uppercase;
}
.alias-ava.has-photo { color: transparent; }
.alias-ava.big { width: 60px; height: 60px; font-size: 21px; }
.alias-main { min-width: 0; flex: 1; }
.alias-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.alias-addr { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; word-break: break-all; }
.alias-note { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.alias-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 99px; background: var(--accent-wash); color: var(--accent-ink); font-size: 10.5px; font-weight: 400; }
.alias-tag.plain { background: #f1f4f5; color: var(--muted); }
.alias-tag.off { background: #f4f1ee; color: #8d7a6b; }
.alias-acts { display: flex; align-items: center; gap: 4px; flex: none; }
.alias-lock { display: inline-flex; align-items: center; gap: 4px; height: 29px; padding: 0 9px; border: 1px solid #e6eaeb; border-radius: 5px; background: #f8fafa; color: var(--muted); font-size: 11.5px; }
.alias-lock svg { width: 12px; height: 12px; }
.alias-del { display: inline-flex; align-items: center; gap: 5px; }
.alias-del svg { width: 13px; height: 13px; }
.alias-del svg, .alias-lock svg { fill: currentColor; stroke: none; }
.alias-item.off .alias-ava { opacity: .55; }
.alias-item.off .alias-name { color: var(--muted); }

.alias-editor { border: 1px solid var(--line); border-radius: 10px; padding: 20px 20px 16px; margin-top: 14px; background: #fff; }
.alias-editor h3 { font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.alias-editor h3 span { font-weight: 400; color: var(--faint); font-size: 11.5px; margin-left: 8px; }
.alias-editor .ava-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.alias-editor .ava-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alias-editor .ava-hint { font-size: 11px; color: var(--faint); }
.alias-editor .editor-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.alias-editor .editor-foot .sp { flex: 1; }
.alias-empty { padding: 44px 20px; text-align: center; color: var(--faint); font-size: 13px; }
.alias-empty b { display: block; color: var(--muted); font-size: 13.5px; font-weight: 500; margin-bottom: 4px; }

@media (max-width: 700px) {
  .alias-primary, .alias-item { flex-wrap: wrap; padding: 14px; }
  .alias-acts { margin-left: auto; }
  .alias-editor { padding: 16px 15px 14px; }
  .alias-editor .ava-row { align-items: flex-start; }
}

/* ---------- forms ---------- */
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 16px; margin-top: 20px; background: #fff; }
.panel[hidden] { display: none; }
.panel h3 { font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px;
  background: #fff; font-size: 13px; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #c9a084; box-shadow: 0 0 0 3px #f7e6da; outline: none; }
.field textarea { min-height: 190px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; }
.field .hint { font-size: 11px; color: var(--faint); }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }
.form-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.form-foot .msg { font-size: 12px; color: #a8401f; margin-left: auto; }
.form-foot .msg.ok { color: var(--ok); }

/* ---------- lists ---------- */
.list { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.item { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.item:last-child { border-bottom: 0; }
.item:hover { background: #fbfcfc; }
.item .main { min-width: 0; flex: 1; }
.item .title { font-size: 13.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub code { font-family: var(--mono); font-size: 11.5px; color: var(--accent-ink); background: var(--accent-wash); padding: 1px 5px; border-radius: 4px; }
.item .meta { font-size: 11px; color: var(--faint); margin-top: 5px; display: flex; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.item .acts { display: flex; gap: 4px; flex: none; }
.icon-btn { width: 28px; height: 28px; border-radius: 5px; display: grid; place-items: center; color: var(--faint); }
.icon-btn:hover { background: var(--wash); color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; }
.pill { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 99px; font-size: 10.5px; letter-spacing: .02em; background: #eef3ef; color: var(--ok); }
.pill.off { background: #f4f1ee; color: #8d7a6b; }
.pill.burn { background: var(--accent-wash); color: var(--accent-ink); }
.empty { padding: 46px 20px; text-align: center; color: var(--faint); font-size: 13px; }
.empty b { display: block; color: var(--muted); font-size: 13.5px; font-weight: 500; margin-bottom: 4px; }

/* ---------- width ladder ----------
   Same breakpoints as mail.html so the rail is never a different width on the two
   pages: 220 on big screens, 208 by default, 184 when space gets tight, a 72 px
   icon rail on tablets, and a horizontal top bar on phones. */
@media (min-width: 1600px) {
  .app { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 1200px) {
  .app { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
}
@media (min-width: 701px) and (max-width: 960px) {
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding: 27px 10px 0; }
  .brand { padding: 0; text-align: center; }
  .brand a { font-size: 29px; }
  .account { justify-content: center; margin: 25px 0 20px; padding: 0; }
  .account .who, .account > .ico { display: none; }
  .nav-section { display: none; }
  .nav-item { padding: 0; justify-content: center; gap: 0; }
  .nav-item .label, .nav-item .count { display: none; }
  .sidebar-foot { justify-content: center; padding: 0; }
  .sidebar-foot .status-text, .sidebar-foot .dot-live, .sidebar-foot .foot-date { display: none; }
}

/* ---------- mobile: top bar + drawer, same pattern as mail.html ---------- */
.topbar { display: none; }

.moverlay {
  position: fixed; inset: 0; background: #1d202140; z-index: 40;
  display: none; align-items: center; justify-content: center; padding: 14px;
}
.moverlay.show { display: flex; }
.msheet {
  background: #fff; border-radius: 12px; box-shadow: 0 18px 90px #1f222330;
  width: min(420px, 100%); max-height: calc(100dvh - 28px); display: flex; flex-direction: column;
}
.msheet-head { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line-soft); }
.msheet-head h3 { font-family: var(--serif); font-size: 26px; font-weight: 400; letter-spacing: -1px; color: var(--ink); }
.moverlay .icon-btn { width: 30px; height: 30px; }
.mnav-list { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 7px; overflow: auto; }
.mnav-list a, .mnav-list button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 12px; border-radius: 5px; font-size: 14px; color: #595c5d;
  text-align: left; text-decoration: none;
}
.mnav-list a:hover, .mnav-list button:hover { background: #edf0f1; text-decoration: none; }
.mnav-list span { color: #919495; font-size: 12px; }
.mnav-list a.on { background: var(--accent-wash); color: var(--accent-ink); }
.mnav-list a.on span { color: var(--accent-ink); }
.mnav-list button:last-child { border-top: 1px solid var(--line); margin-top: 8px; border-radius: 0; padding-top: 18px; color: #8a4c22; }

@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; align-content: start; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 22px 18px 4px; }
  .topbar h1 { font-size: 23px; font-weight: 600; letter-spacing: -.3px; line-height: 1.3; }
  .topbar-menu { margin-left: auto; font-family: var(--serif); font-size: 29px; line-height: 1; color: #494c4d; padding: 0 2px; }
  .content { padding: 16px 18px 54px; }
  .page-head { align-items: flex-start; padding-bottom: 14px; }
  .page-head .eyebrow, .page-head h1 { display: none; }
  .page-head p { margin-top: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .item { flex-wrap: wrap; }
  .item .acts { margin-left: auto; }
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: #23282a; color: #f5f7f8; font-size: 12.5px; padding: 10px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease);
  max-width: min(90vw, 460px); text-align: center; z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }