:root {
    --bg: #f4f5f2;
    --panel: #ffffff;
    --ink: #1d2320;
    --muted: #5f6b66;
    --line: #d9ddd8;
    --accent: #1f5f4a;
    --accent-ink: #ffffff;
    --danger: #a3322a;
    --focus: #2f8a6b;
    --radius: 6px;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem 1.25rem; background: var(--accent); color: var(--accent-ink);
}
.topbar a { color: inherit; text-decoration: none; }
.topbar .brand { font-weight: 700; letter-spacing: .02em; }
.topbar nav { display: flex; gap: 1.25rem; font-size: .95rem; }
.topbar nav a { opacity: .85; }
.topbar nav a:hover { opacity: 1; text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
h1 { font-size: 1.6rem; margin: .25rem 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.muted { color: var(--muted); margin-top: 0; }

.panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.1rem; margin: 1rem 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.count { font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; margin-left: .35rem; }

.grid { display: grid; gap: .65rem .8rem; }
.header-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wpis-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; color: var(--muted); }
label small { font-size: .72rem; }
label.check { flex-direction: row; align-items: center; gap: .4rem; font-size: .85rem; }

input, select, output {
    font: inherit; font-size: .95rem; color: var(--ink);
    padding: .42rem .5rem; border: 1px solid var(--line); border-radius: 4px; background: #fff; min-width: 0; width: 100%;
}
output { background: #f7f8f6; border-style: dashed; font-variant-numeric: tabular-nums; }
input:focus, select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
input[type=checkbox] { width: auto; }

.wpis {
    position: relative; border: 1px solid var(--line); border-left: 4px solid var(--accent);
    border-radius: var(--radius); padding: .6rem .9rem .5rem; margin: 0 0 .8rem;
}
.wpis legend { font-weight: 600; font-size: .85rem; padding: 0 .35rem; color: var(--accent); }
.wpis-tools { position: absolute; top: -.55rem; right: .75rem; display: flex; gap: .5rem; background: var(--panel); padding: 0 .35rem; }
.wpis-info { margin: .45rem 0 0; font-size: .8rem; color: var(--muted); min-height: 1em; }

.btn {
    font: inherit; font-size: .95rem; padding: .55rem 1rem; border-radius: 4px; cursor: pointer;
    border: 1px solid var(--accent); background: #fff; color: var(--accent);
}
.btn:hover { background: #eef4f1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #184c3b; }
.btn-ghost { border-color: transparent; }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: .8rem; color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; position: sticky; bottom: 0; padding: .75rem 0; background: var(--bg); }

.alert { border-radius: var(--radius); padding: .7rem 1rem; margin: 1rem 0; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-error { background: #fbeceb; border: 1px solid #e7b9b5; color: var(--danger); }
.alert-ok { background: #e8f3ee; border: 1px solid #b5d6c7; color: var(--accent); }
.validation-summary-valid { display: none; }
.alert-info { background: #eef3f8; border: 1px solid #c4d4e6; color: #284766; }
.alert a { color: inherit; font-weight: 600; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar form { margin: 0; }
label.btn { display: inline-flex; flex-direction: row; font-size: .95rem; color: var(--accent); }
.small { font-size: .82rem; margin: .6rem 0 0; }
.danger-text { color: var(--danger); }
table.edytor td { padding: .2rem .3rem; }
table.edytor input:not([type=checkbox]) { padding: .3rem .4rem; font-size: .88rem; }
table.edytor input.short { max-width: 9rem; }
@media (max-width: 760px) {
    table.edytor, table.edytor tbody, table.edytor tr, table.edytor td { display: block; width: 100%; }
    table.edytor thead { display: none; }
    table.edytor tr { border-bottom: 1px solid var(--line); padding: .4rem 0; }
    table.edytor input.short { max-width: none; }
}

table.lista { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.lista th, table.lista td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.lista th { color: var(--muted); font-weight: 600; }
details { margin: .5rem 0; }
summary { cursor: pointer; font-weight: 600; }

@media (max-width: 760px) {
    .container { padding: 1rem .75rem 2rem; }
    .header-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .header-grid .span-2, .header-grid .span-4 { grid-column: span 2; }
    /* wpis na telefonie: siatka 6 kolumn – nazwisko/kod/lokalizacja na całą szerokość, godziny po 3 w rzędzie */
    .wpis-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .wpis-grid .m-2 { grid-column: span 2; }
    .wpis-grid .m-3 { grid-column: span 3; }
    .wpis-grid .m-6 { grid-column: span 6; }
    .wpis { padding: .6rem .6rem .5rem; }
    .actions .btn { flex: 1 1 auto; }
}

/* długie listy w „Moich danych” przewijane w ramce */
[data-edytor] { max-height: 28rem; overflow: auto; border: 1px solid var(--line); border-radius: 4px; padding: 0 .4rem; }
[data-edytor] > .btn { position: sticky; bottom: 0; background: var(--panel); width: 100%; text-align: left; }
[data-edytor] thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }

/* konta */
.inline { display: inline; margin: 0; }
.link-nav { background: none; border: 0; padding: 0; font: inherit; font-size: .95rem; color: inherit; opacity: .85; cursor: pointer; }
.link-nav:hover { opacity: 1; text-decoration: underline; }
.topbar nav { align-items: center; }
.auth { max-width: 26rem; margin: 2rem auto; }
.auth-form { display: flex; flex-direction: column; gap: .8rem; }
.auth-form .btn { align-self: flex-start; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: .75rem 0 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.kopiuj { display: flex; gap: .5rem; }
.kopiuj input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
td.akcje { white-space: nowrap; }
td.akcje .inline + .inline { margin-left: .75rem; }
