/* Contawee: own layer on top of Design FM ui.css (pagina del guscio, con la colonna laterale).
   The rules are those of CLAUDE.md, «Regole d'interfaccia», which point to Design FM (html-ui). This layer holds only
   what is Contawee's own: the concepts of its domain, and the generic pieces that ui.css does not have yet, proposed to the
   library and kept here until it has them. Fields, window, «i», tendine and the head of the page are Design FM 1.72.1.
   It never rewrites a selector of the library, never the padding or height of a table cell (the row is --tbl-riga),
   never a font size or a radius in px: check with `manage.py ui_snapshot` and check_ui.py of Design FM. */

/* ---- Frame: the content column of the guscio ---- */
body:has(> .lat) .wrap > * + * { margin-top: var(--sp-4); }
body:has(> .lat) .wrap > .foot { margin-top: var(--sp-5); }
/* The Overview is drawn inside its own box (#pano): its blocks keep the step of the 1.21 between them. */
body:has(> .lat) .wrap > #pano > * + * { margin-top: var(--sp-4); }
body:has(> .lat) .wrap > .pg-h + * { margin-top: 0; }
/* The context bar (.ctx) is fixed, or hidden under 1024 px: it takes no room, so what follows it starts where the
   library puts the top of the page, without the step between two blocks (Design FM 1.74.0, the frame in an app). */
body:has(> .lat) .wrap > .ctx + * { margin-top: 0; }
.panel h1 { font-size: var(--fs-subsection); color: var(--ink); margin: 0; }
.panel h2 { font-size: var(--fs-sub); color: var(--ink); margin: 0; }
.panel.narrow { max-width: 440px; width: 100%; justify-self: start; }

/* ---- Forms: fields, buttons and the window are Design FM's (v1.71.0 and later, «App: testa, campi, finestra»). Own: the layouts ---- */
.field-check { align-self: end; display: flex; align-items: center; min-height: var(--g-campo); }
.field-check .lbl { display: flex; align-items: center; }
.k { font-family: var(--mono); font-size: var(--fs-note); border: 1px solid currentColor; border-radius: var(--r-xs); padding: 0 var(--sp-0); opacity: .8; margin-left: 4px; }
.msgs { display: grid; gap: var(--sp-1); }
.msg { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-s); background: var(--info-soft); color: var(--ink); }
.msg-warning { background: var(--warn-soft); }
.msg-error { background: var(--crit-soft); }

/* ---- The window over the page is Design FM's (dialog.dlg). Own: its margin inside the guscio column, the panes of a window with
   tabs (Uscita, Entrata, Trasferimento) ---- */
body:has(> .lat) .wrap > dialog.dlg { margin: auto; }
.dlg-pane[hidden] { display: none; }

/* ---- Tables: the .tbl of Design FM. Own classes only for the domain (widths, colours of a kind of row) ---- */
/* Icon tiles and tag pills are one line tall (1lh), so a row with them is 44 px like every other row. */
a.sort { color: inherit; text-decoration: none; }
a.sort:hover { color: var(--accent); }
table.reg-off td { color: var(--muted); }

/* Accounts: the tile is Design FM's `.ico-t` (1.81.0, risen from Contawee, DEC-26-053, 129), with its own 8 px to the name;
   the image, or the currency symbol for cash on the soft grey ground (`.ico-s`). Own: the line of name and currency. */
.acc { display: flex; align-items: center; min-width: 0; }
.acc .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Categories: their icon is Design FM's `.ico-v` (1.80.0, DEC-26-126); nothing of its own here. */
/* Where the account is the subject of the row (Saldi, Conti) its name is 600 in ink; in Movimenti it stays normal (DEC-26-054, 4).
   The currency beside the name is grey monospace text, no box. */
.acc-main .nm { font-weight: 600; color: var(--ink); }
.cur { font-family: var(--mono); font-size: var(--fs-label); color: var(--muted); }
.acc .cur { flex: none; margin-left: var(--sp-1); }
/* The currency in an amount cell (Saldi): a clear step after the number, in its own slot */
.cu { font-family: var(--mono); font-size: var(--fs-label); color: var(--muted); display: inline-block; width: 3em; margin-left: var(--sp-1); text-align: left; }

/* Tags: the .chip of Design FM, with the colour of the tag (a domain concept: the palette c1..c8, chosen by Federico).
   The chip is 22 px, taller than a line of the table, and made its row 47 px: without the vertical padding it is one line
   tall and the row stays 44 px. Asked to the library (prompt for Claude OS of 17/11/2026, chip inside a .tbl row). */
.tg { color: var(--ink); background: var(--idle-soft); }
.tg::before { background: var(--idle); }
.tg[data-c] { background: color-mix(in srgb, var(--idle) 14%, var(--surface)); }
.tg[data-c="c1"] { background: color-mix(in srgb, var(--c1) 16%, var(--surface)); } .tg[data-c="c1"]::before { background: var(--c1); }
.tg[data-c="c2"] { background: color-mix(in srgb, var(--c2) 16%, var(--surface)); } .tg[data-c="c2"]::before { background: var(--c2); }
.tg[data-c="c3"] { background: color-mix(in srgb, var(--c3) 16%, var(--surface)); } .tg[data-c="c3"]::before { background: var(--c3); }
.tg[data-c="c4"] { background: color-mix(in srgb, var(--c4) 16%, var(--surface)); } .tg[data-c="c4"]::before { background: var(--c4); }
.tg[data-c="c5"] { background: color-mix(in srgb, var(--c5) 16%, var(--surface)); } .tg[data-c="c5"]::before { background: var(--c5); }
.tg[data-c="c6"] { background: color-mix(in srgb, var(--c6) 16%, var(--surface)); } .tg[data-c="c6"]::before { background: var(--c6); }
.tg[data-c="c7"] { background: color-mix(in srgb, var(--c7) 16%, var(--surface)); } .tg[data-c="c7"]::before { background: var(--c7); }
.tg[data-c="c8"] { background: color-mix(in srgb, var(--c8) 16%, var(--surface)); } .tg[data-c="c8"]::before { background: var(--c8); }
.tg + .tg { margin-left: 4px; }
.sw-pick { position: relative; }
.sw-pick summary { list-style: none; display: inline-flex; align-items: center; gap: var(--sp-1); cursor: pointer; padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--line-strong); border-radius: var(--r-xs); background: var(--surface); }
.sw-pick summary::-webkit-details-marker { display: none; }
.sw-car { color: var(--muted); font-size: var(--fs-note); }
.sw-pop { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; display: grid; grid-template-columns: repeat(3, max-content); gap: var(--sp-1);
  padding: var(--sp-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); box-shadow: var(--shadow-pop); }
.sw { cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw input:checked + .tg { box-shadow: 0 0 0 2px var(--ink); font-weight: 600; }
.sw input:focus-visible + .tg { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Movimenti ---- */
.tx-form { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 721px) { .tx-form { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tx-form > * { min-width: 0; }
.tx-form .blk-l, .tx-form .actions, .tx-form .msg { grid-column: 1 / -1; }
@media (min-width: 721px) { .tx-wide, .tx-pair > .field:has([name$="description"]) { grid-column: span 2; } }
.tx-edit { max-width: var(--g-dlg-l); gap: var(--sp-4); }
.tx-del { margin-left: auto; }
.sg { font-size: var(--fs-note); color: var(--muted); }
/* Movimenti (DEC-26-144): payee, category and description are Design FM's dotted columns (td.td-p, 1.86.0), and guscio.js
   shares the room among them; date, account, the narrow column and the amount stay whole. Under 1180 px the tag,
   description and narrow columns go (all three are in Modifica, tag and description also in the filters). */
table.tx-table td a { color: inherit; text-decoration: none; }
table.tx-table td.tx-seg { text-align: right; }
tr.tx-transfer td { color: var(--muted); }
@media (max-width: 1180px) and (min-width: 721px) {
  table.tx-table :is(td, th):is(:nth-child(5), :nth-child(6), :nth-child(7)) { display: none; }
  table.tx-table .tx-ci { display: none; }  /* the payee keeps its room (DEC-26-122) */
}

/* ---- Entrate e uscite ---- */
/* Always the twelve months (DEC-26-136), whole euros with the symbol in every cell (Design FM 1.100.0, DEC-26-285). Where the
   table does not fit, the library first narrows the gaps between columns, then the card scrolls sideways with header, names
   and total held still, opened on the last month with data. Nothing here holds a column still or sets a width. */
table.ce-table { width: 100%; }
/* A number that opens its movements: the whole cell is the target, tinted on hover with the fill of the clickable row of
   Design FM, never underlined (DEC-26-110). The link covers the cell from its corners, so no cell padding changes. */
table.ce-table td.n:has(> a) { position: relative; cursor: pointer; }
table.ce-table td.n > a { color: inherit; text-decoration: none; }
table.ce-table td.n > a::after { content: ""; position: absolute; inset: 0; }
@media (hover: hover) { table.ce-table td.n:has(> a):hover { background: color-mix(in srgb, var(--sunk) var(--tenue-fondo), var(--surface)); } }
table.ce-table td.n > a:focus-visible { outline: none; }
table.ce-table td.n:has(> a:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Two left edges only (DEC-26-125): titles, totals and the icons of the rows on the edge of the table, the names of the rows
   in one column after the icon. Risparmio lordo is a total, on the edge (DEC-26-127). */
/* Net savings is the only number in green or red: what is left at the end, taxes paid (DEC-26-117, 130). Gross savings and
   the savings rate stay in ink. */
tr.riga-tot.ce-result td.pos { color: var(--ok); }
tr.riga-tot.ce-result td.neg { color: var(--crit); }
tr.ce-rate td { font-weight: 600; color: var(--ink); }
td.ce-tot { font-weight: 600; color: var(--ink); }
/* On a phone the year total only: twelve months do not fit in 375 px (the phone is a later module, Roadmap). */
.ce-phone { display: none; }
@media (max-width: 720px) {
  .ce-phone { display: block; }
  table.ce-table :is(td, th):is(:nth-child(2), :nth-child(3), :nth-child(4), :nth-child(5), :nth-child(6), :nth-child(7),
    :nth-child(8), :nth-child(9), :nth-child(10), :nth-child(11), :nth-child(12), :nth-child(13)) { display: none; }
}

/* ---- Panoramica: the tiles. The charts are Design FM's (svg.chart, .compo), nothing of their own here (DEC-26-064) ---- */

/* ---- Import checks (own: one row per check of the import, green or red) ---- */
.imp-cks { display: grid; gap: var(--sp-1); }
.imp-ck { border-radius: var(--r-s); padding: var(--sp-2) var(--sp-3); }
.imp-ok { background: var(--ok-soft); }
.imp-no { background: var(--crit-soft); }
.imp-ck ul { list-style: disc; padding-left: var(--sp-4); margin-top: var(--sp-0); font-size: var(--fs-small); }

/* ---- Guide ---- */
.guide h2 { margin-top: var(--sp-3); }
.guide p, .guide li { max-width: 72ch; }
.guide ul { list-style: disc; padding-left: var(--sp-4); display: grid; gap: var(--sp-0); }

/* ---- Page controls in the head (DEC-26-053): tendine, groups, search, period box and the tile of an entry are Design FM's ---- */

/* Categories: the switch of a catalogue category sits under its header, on the right (DEC-26-078). */
.cat-sw { display: flex; }
/* Categorie: the name, then «Cosa ci va» in clear (DEC-26-089), the switch at the end of the row (DEC-26-293, Design FM 1.101.0) */
.cat-n { white-space: nowrap; }
/* «Cosa ci va» stays on one line and ends with dots where it does not fit: the column with dots of Design FM (td.td-p,
   1.85.0), which also writes the whole text in the title of a cut cell. On a phone the column goes (below). */
@media (max-width: 719px) { .cat-note, th.cat-note { display: none; } .cat-n { white-space: normal; } }
/* The level of a category (DEC-26-290, 331): a short word, on one line. */
.cat-l { white-space: nowrap; }  /* on a phone «Cosa ci va» is the secondary column that goes, so nothing scrolls sideways (DEC-26-048) */

/* An image field (core/files.py, ImageInput): the current image as a preview the height of a field, «Remove» beside it. */
.img-now { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-1); }
.img-th { width: var(--g-campo); height: var(--g-campo); flex: none; box-sizing: border-box; display: inline-grid; place-items: center;
  overflow: hidden; border-radius: var(--r-segno); border: 1px solid var(--line); background: var(--surface); padding: var(--sp-0); }
.img-th img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tx-prov { display: grid; gap: var(--sp-0); } .tx-prov p { margin: 0; }
/* The dash of absence (Design FM, «Formati»): a month without movements, muted so the numbers stand out (DEC-26-091) */
.ce-nil { color: var(--muted); }

/* ---- Panoramica (DEC-26-124) ---- */
/* The boxes side by side sit on the .g12 of Design FM, each in its own cell: the space before the grid and between its
   rows is the one between the boxes above (--sp-4, the content column's), and a box is as tall as its row. */
.pano-grid { margin-top: var(--sp-4); row-gap: var(--sp-4); }
.pano-cell { display: grid; }
.pano-fill { align-content: start; }  /* as tall as its neighbour, its content from the top */

/* Backup: the folder of the copies is one long path with no spaces; it breaks anywhere instead of widening the page. */
.bk-dir { overflow-wrap: anywhere; }
/* Backup: the label of each column when the table of the copies becomes cards; its style is the library's. */
.bk-copie td[data-l]::before { content: attr(data-l); }
