/* Poczta, styl Hahu: czerń, jedna mięta, Outfit Light, kreski zamiast ramek. */

@font-face { font-family: Outfit; font-weight: 300; font-display: swap; src: url(fonts/outfit-300.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: Outfit; font-weight: 300; font-display: swap; src: url(fonts/outfit-ext-300.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Outfit; font-weight: 400; font-display: swap; src: url(fonts/outfit-400.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: Outfit; font-weight: 400; font-display: swap; src: url(fonts/outfit-ext-400.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Outfit; font-weight: 500; font-display: swap; src: url(fonts/outfit-500.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: Outfit; font-weight: 500; font-display: swap; src: url(fonts/outfit-ext-500.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #080808;
  --navy: #00192F;
  --surface: #111111;
  --surface-2: #181818;
  --text: #F5F5F5;
  --text-body: #cccccc;
  --text-muted: #8f8f92;
  --text-muted-navy: #9fb2c4;
  --accent: #3CDBC0;
  --danger: #ff8a7a;
  --warn-bg: #2a1a12;
  --border: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.24);
  --field: rgba(255, 255, 255, 0.06);
  --radius: 3px;
  --titlebar: 44px;
  --ease: cubic-bezier(.65, 0, .35, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 300 16px/1.45 Outfit, "Century Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea { user-select: text; -webkit-user-select: text; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { flex-shrink: 0; }

.label {
  font-size: 13px; line-height: 1.5; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted);
}
.dot { color: var(--accent); }

/* ---------- układ ---------- */

.app {
  display: grid;
  grid-template-columns: 248px minmax(340px, 420px) minmax(0, 1fr);
  height: 100vh;
}
.pane { height: 100vh; overflow-y: auto; border-right: 1px solid var(--border); }
.pane:last-child { border-right: 0; }
.drag { display: none; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 220px minmax(300px, 360px) minmax(0, 1fr); }
}

/* ---------- przyciski ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--text); font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.btn:hover { border-color: var(--text-muted); }
.btn:active { transform: scale(.965); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn--icon { width: 44px; padding: 0; justify-content: center; background: transparent; border-color: var(--border); color: var(--text-body); }
.btn--icon[aria-pressed="true"] { color: var(--accent); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-body); }
.btn--ghost:hover { border-color: var(--border); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--bg); padding: 0 8px 0 20px; height: 56px; gap: 14px; }
.btn--primary:hover { border-color: var(--accent); filter: brightness(1.05); }
.btn--tile { justify-content: space-between; padding: 0 8px 0 18px; height: 56px; width: 100%; }
.tile {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--accent); color: var(--bg);
}
.btn--primary .tile { background: var(--bg); color: var(--accent); }

/* ---------- panel boczny ---------- */

.sidebar { display: flex; flex-direction: column; padding: 28px 16px 20px; }
.sidebar > * { flex-shrink: 0; }
.brand { display: flex; align-items: baseline; gap: 1px; padding: 4px 8px 24px; font-size: 22px; letter-spacing: -0.02em; }
.nav { display: flex; flex-direction: column; gap: 2px; padding-top: 24px; }
.nav + .nav { margin-top: 20px; border-top: 1px solid var(--border); }
.nav__head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; }
.nav__head button { border: 0; background: transparent; color: var(--text-muted); width: 32px; height: 32px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.nav__head button:hover { color: var(--text); background: var(--surface); }
.nav__item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 8px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-body); text-align: left; width: 100%;
}
.nav__item:hover { background: var(--surface); }
.nav__item[aria-current="true"] { background: var(--surface); color: var(--text); font-weight: 400; }
.nav__item span:first-of-type { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 14px; font-weight: 500; color: var(--accent); }
.count--muted { color: var(--text-muted); font-weight: 300; }
.sidebar__foot { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.sync { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; }
.sync button { border: 0; background: transparent; color: var(--text-muted); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); }
.sync button:hover { color: var(--text); background: var(--surface); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lista ---------- */

.list { display: flex; flex-direction: column; }
.list__head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 28px 24px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.list__title { display: flex; align-items: center; gap: 12px; }
.list__title .label { margin-left: auto; }
.list__title h1 { margin: 0; font-weight: 300; font-size: 28px; line-height: 1.1; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--text-muted); }
.search:focus-within { border-color: var(--text-muted); }
.search input { flex-grow: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); }
.search kbd { font: 500 12px Outfit, sans-serif; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 1px 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: transparent; color: var(--text-body); font-size: 14px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.row {
  display: flex; gap: 14px; width: 100%; padding: 18px 24px; border: 0; border-bottom: 1px solid var(--border);
  background: transparent; color: var(--text-body); text-align: left;
}
.compact .row { padding-top: 12px; padding-bottom: 12px; }
.row:hover { background: #0d0d0d; }
.row[aria-current="true"] { background: var(--surface); }
.row__dot { flex: 0 0 6px; padding-top: 9px; }
.row__dot i { display: block; width: 6px; height: 6px; border-radius: 50%; }
.row--unread .row__dot i { background: var(--accent); }
.row__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.row__from { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__time { flex-shrink: 0; font-size: 13px; font-weight: 500; letter-spacing: .5px; color: var(--text-muted); }
.row__subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row--unread .row__from, .row--unread .row__subject { color: var(--text); font-weight: 400; }
.row__preview { font-size: 15px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row__meta { display: flex; align-items: center; gap: 8px; padding-top: 4px; color: var(--text-muted); font-size: 12px; font-weight: 500; letter-spacing: 1.5px; text-transform: uppercase; }
.row__meta svg { color: var(--text-muted); }
.row__meta .star { color: var(--accent); }
.empty { padding: 64px 24px; color: var(--text-muted); text-align: center; }

/* ---------- czytanie ---------- */

.reader { display: flex; flex-direction: column; }
.toolbar { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 24px 40px 16px; border-bottom: 1px solid var(--border); }
.toolbar .grow { flex-grow: 1; }
.msg { padding: 40px 40px 64px; display: flex; flex-direction: column; gap: 24px; max-width: 880px; width: 100%; }
.msg h2 { margin: 0; font-weight: 400; font-size: 28px; line-height: 1.3; letter-spacing: -0.01em; user-select: text; -webkit-user-select: text; }
.sender { display: flex; align-items: center; gap: 14px; }
.avatar { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 14px; font-weight: 500; letter-spacing: 1px; flex-shrink: 0; }
.sender__who { display: flex; flex-direction: column; min-width: 0; flex-grow: 1; user-select: text; -webkit-user-select: text; }
.sender__name { font-weight: 400; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.sender__addr { font-size: 14px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.sender__date { font-size: 14px; color: var(--text-muted); white-space: nowrap; }
.verified { color: var(--accent); display: inline-flex; }
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; color: var(--text-body); }
.notice svg { margin-top: 2px; color: var(--text-muted); }
.notice__text { flex-grow: 1; }
.notice__actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.notice__actions button { height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: transparent; color: var(--text); font-size: 14px; font-weight: 500; }
.notice--danger { border-color: rgba(255, 138, 122, .5); background: var(--warn-bg); color: var(--text); }
.notice--danger svg { color: var(--danger); }
.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }
.body-frame { width: 100%; border: 0; display: block; min-height: 40px; background: var(--bg); }
.files { display: flex; flex-direction: column; gap: 10px; }
.files__list { display: flex; flex-wrap: wrap; gap: 10px; }
.file {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 10px 10px 16px; min-width: 260px; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-align: left;
}
.file__meta { display: flex; flex-direction: column; min-width: 0; }
.file__name { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file__size { font-size: 14px; color: var(--text-muted); }
.file--risky { border-color: rgba(255, 138, 122, .5); }
.file--risky .tile { background: var(--danger); }
.reader__empty { flex-grow: 1; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }

/* ---------- okna: pisanie, konto, potwierdzenia ---------- */

.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; padding: 56px 24px 24px; }
.sheet {
  width: min(880px, 100%); max-height: 100%; overflow: auto; background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius); display: flex; flex-direction: column;
}
.sheet--narrow { width: min(560px, 100%); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 28px; border-bottom: 1px solid var(--border); }
.sheet__head h2 { margin: 0; font-weight: 300; font-size: 26px; letter-spacing: -0.02em; }
.sheet__body { padding: 8px 28px 24px; display: flex; flex-direction: column; }
.sheet__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 20px 28px; border-top: 1px solid var(--border); }
.sheet__foot .grow { flex-grow: 1; }

.field-row { display: flex; align-items: center; gap: 16px; min-height: 56px; border-bottom: 1px solid var(--border); }
.field-row > label, .field-row > .label { flex: 0 0 72px; }
.field-row input, .field-row select { flex-grow: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); padding: 14px 0; }
.field-row select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.field-row select option { background: var(--surface); }
.compose-body { width: 100%; min-height: 320px; border: 0; outline: none; resize: vertical; background: transparent; color: var(--text); font-size: 17px; line-height: 1.6; padding: 20px 0; }
.link-btn { border: 0; background: transparent; color: var(--accent); font-size: 13px; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; padding: 8px 0; }
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 16px; }
.attach { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 6px 0 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.attach button { border: 0; background: transparent; color: var(--text-muted); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }

.form { display: flex; flex-direction: column; gap: 18px; padding: 20px 0 4px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; }
.f { display: flex; flex-direction: column; gap: 8px; }
.f input, .f select {
  height: 48px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--field); color: var(--text); outline: none;
}
.f input:focus, .f select:focus { border-color: var(--text-muted); }
.f small { color: var(--text-muted); font-size: 14px; }
.panel-navy { background: var(--navy); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.panel-navy .label, .panel-navy small { color: var(--text-muted-navy); }
.error { color: var(--danger); font-size: 15px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.welcome { position: fixed; inset: 0; z-index: 10; background: var(--bg); overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 72px 24px 48px; }
.welcome__inner { width: min(560px, 100%); display: flex; flex-direction: column; gap: 24px; }
.welcome h1 { margin: 0; font-weight: 300; font-size: 44px; line-height: 1; letter-spacing: -0.03em; }
.welcome p { margin: 0; color: var(--text-body); font-size: 18px; line-height: 1.55; }

.menu { position: fixed; z-index: 30; min-width: 240px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px; display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 40px; padding: 0 12px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-body); text-align: left; }
.menu button:hover { background: var(--surface-2); color: var(--text); }
.menu .danger { color: var(--danger); }

.toast { position: fixed; z-index: 40; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(560px, calc(100% - 48px)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 14px 18px; color: var(--text); font-size: 15px; display: flex; gap: 12px; align-items: center; }
.toast--error { border-color: rgba(255, 138, 122, .6); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---------- serwer: dodatki ---------- */

.nav__error { margin: 0; padding: 0 8px; color: var(--danger); font-size: 14px; }
.btn--sm { height: 36px; padding: 0 12px; font-size: 14px; }
.btn--bare { border-color: transparent; width: 36px; height: 36px; }
.btn--bare.spin svg { animation: spin 1s linear infinite; }
.btn--danger { background: var(--danger); border-color: var(--danger); color: var(--bg); }
.btn--primary-sm { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.danger { color: var(--danger) !important; }
.muted { color: var(--text-muted); margin: 0; }
.muted strong, .notice strong { font-weight: 500; color: var(--text); }
.selectable { user-select: text; -webkit-user-select: text; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice--list { margin: 12px 24px 0; padding: 10px 14px; font-size: 14px; align-items: center; }
.more { display: block; width: calc(100% - 48px); margin: 16px 24px 32px; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: transparent; color: var(--text-body); font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; color: var(--text-body); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.panel-line { display: flex; flex-direction: column; gap: 10px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.panel-line small { color: var(--text-muted); font-size: 14px; }
.form-grid--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
details.panel-navy summary { line-height: 1.6; }
details.panel-navy[open] summary { margin-bottom: 4px; }
.attach__size { color: var(--text-muted); font-size: 13px; }
.attach .ellipsis { max-width: 220px; }
.attach--busy { color: var(--text-muted); padding-right: 12px; }
.overlay--top { z-index: 50; }
.sheet--compose { width: min(880px, 100%); }
.settings { gap: 20px; padding-top: 20px; }
.table { display: flex; flex-direction: column; }
.table__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.table__row strong { font-weight: 400; color: var(--text); }
.table__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.share-block { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--border); }
a.file { text-decoration: none; }
.fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--bg); align-items: center; justify-content: center; z-index: 5; }
.mobile-only { display: none !important; }
body.page { overflow: auto; user-select: auto; }
body.page .welcome { position: static; min-height: 100vh; }

/* ---------- telefon: jeden panel naraz ---------- */

@media (max-width: 860px) {
  .app { display: block; height: 100dvh; }
  .pane { display: none; height: 100dvh; border-right: 0; }
  .app[data-view="sidebar"] .sidebar,
  .app[data-view="list"] .list,
  .app[data-view="reader"] .reader { display: flex; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .sidebar { padding: calc(20px + env(safe-area-inset-top)) 16px 24px; }
  .list__head { padding: calc(16px + env(safe-area-inset-top)) 16px 14px; gap: 12px; }
  .list__title h1 { font-size: 26px; }
  .row { padding: 16px; }
  .compact .row { padding: 12px 16px; }
  .notice--list { margin: 12px 16px 0; }
  .more { width: calc(100% - 32px); margin: 16px 16px 96px; }
  #rows { padding-bottom: 96px; }
  .toolbar { padding: calc(12px + env(safe-area-inset-top)) 12px 12px; gap: 6px; }
  .toolbar .btn { height: 44px; }
  .msg { padding: 24px 16px 48px; gap: 20px; }
  .msg h2 { font-size: 24px; }
  .sender { flex-wrap: wrap; }
  .sender__date { width: 100%; padding-left: 58px; margin-top: -8px; }
  .file { min-width: 0; width: 100%; max-width: none; }
  .overlay { padding: 0; align-items: stretch; }
  .sheet, .sheet--narrow, .sheet--compose { width: 100%; max-height: none; height: 100dvh; border: 0; border-radius: 0; }
  .sheet__head { padding: calc(14px + env(safe-area-inset-top)) 16px 14px; }
  .sheet__body { padding: 4px 16px 20px; flex-grow: 1; }
  .sheet__foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  .form-grid, .form-grid--2 { grid-template-columns: minmax(0, 1fr); }
  .field-row > label, .field-row > .label { flex-basis: 52px; }
  .compose-body { min-height: 40vh; font-size: 16px; }
  input, select, textarea { font-size: 16px; }
  .welcome { padding: 48px 20px; }
  .welcome h1 { font-size: 36px; }
  .menu { left: 8px !important; right: 8px; }
}
@media (max-width: 480px) {
  .hide-xs { display: none; }
  .toolbar .btn:not(.btn--icon) { padding: 0 12px; }
}
@media (max-width: 1180px) and (min-width: 861px) {
  .hide-sm { display: none; }
}

.summary-note { color: var(--text-muted-navy); font-size: 14px; }
@media (max-width: 860px) { .toolbar { flex-wrap: nowrap; } }
