/* PRZYPOMINACZ — cały wygląd. Bez bibliotek, bez zewnętrznych czcionek. */

:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #6b7682;
    --line: #e1e5ea;
    --accent: #1f5f99;
    --accent-ink: #ffffff;
    --late: #b42318;
    --late-bg: #fdecea;
    --today: #9a4d00;
    --today-bg: #fff1dc;
    --soon: #7a5b00;
    --soon-bg: #fff8db;
    --ok: #2f6b3a;
    --ok-bg: #e7f4ea;
    --top: #1f2933;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
    padding: 10px 24px;
    background: var(--top);
}
.top-title { color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; }
.top-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.top-nav a {
    color: #d5dbe1;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
}
.top-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.top-nav a.on { background: rgba(255, 255, 255, .15); color: #fff; }
.top-nav a.out { margin-left: auto; font-size: 13px; }

.page { max-width: 1180px; margin: 0 auto; padding: 20px 24px 60px; }

h1 { font-size: 22px; margin: 8px 0 14px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
.card h2:first-child { margin-top: 0; }

.count {
    display: inline-block;
    min-width: 24px;
    padding: 0 7px;
    border-radius: 12px;
    background: var(--line);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    vertical-align: middle;
}

.row-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.row-head h1, .row-head h2 { margin-bottom: 10px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 20px;
    margin: 20px 0;
}
.card.narrow { max-width: 420px; margin: 60px auto; }

.flash, .warn {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
}
.flash { background: var(--ok-bg); color: var(--ok); }
.warn { background: var(--late-bg); color: var(--late); }
.error { color: var(--late); font-weight: 600; }

.muted { color: var(--muted); font-weight: normal; }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.text-late { color: var(--late); }
.empty { color: var(--muted); padding: 10px 0; }
.crumbs { margin: 0; font-size: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--muted); margin: -6px 0 8px; }
.notes { background: var(--card); border-left: 3px solid var(--line); padding: 6px 12px; margin: 8px 0; }

/* --- tabele --- */

/* Bez overflow na szerokim ekranie: przewijany kontener przycinałby okienka „Zafakturowane”. */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.card .table-wrap { border: 0; border-radius: 0; }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tr.archived td { color: var(--muted); }
table.list td.actions { text-align: right; white-space: nowrap; }
table.list .num { text-align: right; }
table.keys { table-layout: fixed; }
table.keys td { vertical-align: middle; }
table.keys th:nth-child(1) { width: 17%; }
table.keys th:nth-child(2) { width: 34%; }
table.keys th:nth-child(3) { width: 22%; }
table.keys th:nth-child(5) { width: 150px; }
table.keys input { margin: 0; padding: 5px 8px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.key-add { display: grid; grid-template-columns: 1.2fr 1.4fr 1.2fr 1fr auto; gap: 10px; align-items: end; margin: 12px 0 8px; }
.key-add .error { grid-column: 1 / -1; margin: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .pair { grid-column: 1 / -1; }
table.list td.actions > * { display: inline-block; vertical-align: top; margin-left: 4px; }

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge.late { background: var(--late-bg); color: var(--late); }
.badge.today { background: var(--today-bg); color: var(--today); }
.badge.soon { background: var(--soon-bg); color: var(--soon); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.muted-badge { background: var(--line); color: var(--muted); font-weight: normal; }

/* --- formularze --- */

label { display: block; font-size: 13px; color: var(--muted); }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #c9d0d8;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.stack > * + * { margin-top: 12px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid .span2 { grid-column: 1 / -1; }

.btn {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #c9d0d8;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--late); border-color: #e7b4ae; }
.btn.small { padding: 4px 10px; font-size: 13px; }

.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.search input { width: 260px; margin: 0; }

.tabs { display: flex; gap: 4px; }
.tabs a { padding: 4px 10px; border-radius: 6px; text-decoration: none; font-size: 13px; color: var(--muted); }
.tabs a.on { background: var(--line); color: var(--text); }

/* Rozwijane okienka przy wierszach (Zafakturowane, Edytuj) — bez JavaScriptu. */
details.pop { position: relative; text-align: left; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop[open] > summary { box-shadow: 0 0 0 2px var(--accent); }
details.pop > .pop-body {
    position: absolute;
    right: 0;
    z-index: 10;
    width: 300px;
    margin-top: 6px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
    white-space: normal;
}
.pop-body form > * + *, form.pop-body > * + * { margin-top: 10px; }
.pop-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }

details.edit { margin: 10px 0; }
details.edit > summary { cursor: pointer; color: var(--accent); font-size: 14px; }
details.edit[open] > summary { margin-bottom: 12px; }
.danger-zone { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }

pre.cmd, .mail-preview pre {
    background: #f4f6f8;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    font: 13px/1.45 ui-monospace, Consolas, monospace;
    white-space: pre-wrap;
}
.mail-preview { margin-top: 12px; }
.mail-frame { display: block; width: 100%; height: 320px; margin: 6px 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.mail-subject { font-weight: 600; }

@media (max-width: 720px) {
    .page { padding: 14px 16px 40px; }
    .top { padding: 10px 16px; }
    .top-nav a.out { margin-left: 0; }
    .grid, .two, .key-add { grid-template-columns: 1fr; }
    .search input { width: 100%; }
    .table-wrap { overflow-x: auto; }
    /* Na telefonie okienko rozwija się w wierszu — w przewijanej tabeli pływające by się ucięło. */
    details.pop > .pop-body { position: static; width: 260px; margin-top: 8px; box-shadow: none; }
}
