/* Settings view: profile, category rules, pinned categories, data management */

.settings-stack{
  display:flex;
  flex-direction:column;
  gap:14px;
  max-width:720px;
}
.settings-panel{
  max-width:440px;
}
.settings-panel-wide{
  max-width:none;
}
.settings-field{
  margin-top:18px;
}
/* Name and currency share a line. The currency column is fixed: its content is
   a code and a name, which does not want to grow with the panel. */
.settings-pair{
  display:grid;
  grid-template-columns:1fr 128px;
  gap:12px;
  align-items:end;
}
/* Three-way appearance switch. A segmented control rather than a toggle,
   because "system" is a real third state and not the absence of a choice. */
.seg{
  display:inline-flex;
  padding:3px;
  gap:2px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--paper);
}
.seg-btn{
  border:none;
  border-radius:7px;
  background:transparent;
  color:var(--text-dim);
  font-family:var(--font-body);
  font-size:12px;
  font-weight:500;
  padding:6px 14px;
  cursor:pointer;
}
.seg-btn:hover{color:var(--text);}
.seg-btn[aria-checked="true"]{background:var(--card); color:var(--text); box-shadow:var(--shadow-card);}
.seg-btn:focus-visible{outline:2px solid var(--teal); outline-offset:1px;}

/* A button dressed as an input, opening the app's own menu instead of the OS one. */
.currency-picker{position:relative;}
.settings-trigger{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  cursor:pointer;
  text-align:left;
}
.settings-caret{width:10px; height:6px; flex:none; color:var(--text-dim);}
/* Wider than its trigger, which shows only the code: the full names need the
   room, and hanging left keeps the panel inside the card. */
#currencyMenu{right:0; width:236px;}
.settings-label{
  display:block;
  font-size:12px;
  font-weight:600;
  color:var(--text-dim);
  margin-bottom:7px;
}
.settings-input{
  width:100%;
  font-family:var(--font-body);
  font-size:14px;
  font-weight:500;
  color:var(--text);
  border:1px solid var(--line-input);
  border-radius:9px;
  padding:10px 13px;
  background:var(--paper);
}
.settings-input:focus{outline:2px solid var(--teal); outline-offset:1px;}
.settings-hint{
  margin-top:9px;
  font-size:11.5px;
  color:var(--text-faint);
  line-height:1.55;
}
.settings-hint code{
  font-family:var(--font-mono);
  font-size:10.5px;
  background:var(--line-soft);
  padding:1px 5px;
  border-radius:4px;
}
.settings-warning{
  margin:10px 0 0;
  font-size:12px;
  font-weight:600;
  color:var(--rust);
  background:var(--rust-soft);
  border-radius:8px;
  padding:9px 12px;
}
.settings-actions{
  margin-top:16px;
  display:flex;
  flex-wrap:wrap;   /* three buttons do not fit a phone's width on one line */
  gap:10px;
}

/* ---- Last import ----
   What the most recent import could not do, shown only when there was something
   to say. Sits on --card rather than a tinted panel: --text-dim measures 4.29:1
   on --line-soft in the light theme, which is under AA, and the severity reads
   from the rule down the left edge instead. */
.import-report{
  margin-top:12px;
  padding:11px 13px;
  border:1px solid var(--line);
  border-radius:9px;
}
.import-report-head{
  margin:0 0 9px;
  font-size:12px;
  line-height:1.5;
  color:var(--text);
}
.import-report-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}
/* 3.39:1 (light) and 7.55:1 (dark) against --card — over the 3:1 that WCAG
   1.4.11 asks of a non-text indicator. */
.import-report-item{
  font-size:12px;
  line-height:1.5;
  color:var(--text);
  padding-left:9px;
  border-left:2px solid var(--gold);
}
.import-report-item.is-error{border-left-color:var(--rust);}
.import-report-where{
  color:var(--text-dim);
  font-variant-numeric:tabular-nums;
  margin-right:6px;
}
.import-report-more{
  margin:8px 0 0;
  font-size:11.5px;
  color:var(--text-dim);
}
.import-report .btn{
  margin-top:11px;
  font-size:11.5px;
  padding:5px 11px;
}

/* ---- Category rules ---- */

/* Grid template is shared by the header and every row so the columns line up. */
.rules-head,
.rule-row{
  display:grid;
  grid-template-columns:1fr 1fr 44px auto auto auto;
  gap:8px;
  align-items:center;
}
.rules-head{
  margin-top:16px;
  padding:0 2px 8px;
  border-bottom:1px solid var(--line);
  font-size:10.5px;
  text-transform:uppercase;
  letter-spacing:0.05em;
  font-weight:600;
  color:var(--text-faint);
}
.rule-hits-head{text-align:center;}
.rules-body{
  max-height:340px;
  overflow-y:auto;
  padding:4px 2px;
  margin:0 -2px;
}
.rule-row{
  padding:4px 0;
}
.rule-row input{
  font-family:var(--font-body);
  font-size:12.5px;
  color:var(--text);
  border:1px solid transparent;
  border-radius:7px;
  padding:6px 9px;
  background:var(--paper);
  min-width:0;
}
.rule-row input:hover{border-color:var(--line);}
.rule-row input:focus{outline:2px solid var(--teal); outline-offset:0; border-color:transparent;}
.rule-hits{
  font-family:var(--font-mono);
  font-size:11.5px;
  font-weight:600;
  color:var(--text-faint);
  text-align:center;
}
.rule-move,
.rule-delete,
.override-clear{
  border:none;
  background:transparent;
  color:var(--text-faint);
  font-size:12px;
  line-height:1;
  padding:6px 7px;
  border-radius:6px;
  cursor:pointer;
  transition:background .15s ease, color .15s ease;
}
.rule-move:hover:not(:disabled),
.rule-delete:hover,
.override-clear:hover{background:var(--line-soft); color:var(--text);}
.rule-delete:hover,
.override-clear:hover{color:var(--rust);}
.rule-move:disabled{opacity:0.25; cursor:default;}

/* ---- Accounts ---- */
/* Same shape as a rule row: an editable name, then fixed-width controls. */

.ledger-row{
  display:grid;
  /* name · file · currency · show · delete */
  grid-template-columns:1fr 1fr auto auto auto;
  gap:8px;
  align-items:center;
  padding:4px 0;
}
/* Narrow, because it holds a three-letter code and nothing else — and the row's
   two flexible columns are the name and the file name, which are what a person
   actually reads along. */
.ledger-currency{
  font-family:var(--font-mono);
  font-size:12px;
  font-weight:600;
  color:var(--text-dim);
  background:var(--paper);
  border:1px solid transparent;
  border-radius:7px;
  padding:6px 4px 6px 7px;
  cursor:pointer;
}
.ledger-currency:hover{border-color:var(--line-input); color:var(--text);}
.ledger-currency:focus-visible{outline:2px solid var(--teal); outline-offset:1px;}

.ledger-row input{
  font-family:var(--font-body);
  font-size:12.5px;
  font-weight:600;
  color:var(--text);
  border:1px solid transparent;
  border-radius:7px;
  padding:6px 9px;
  background:var(--paper);
  min-width:0;
}
.ledger-row input:hover{border-color:var(--line);}
.ledger-row input:focus{outline:2px solid var(--teal); outline-offset:0; border-color:transparent;}
.ledger-file{
  font-size:11.5px;
  color:var(--text-faint);
  min-width:0;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
/* A label, not a button: the ledger you are already looking at has nothing to
   switch to, and a disabled button there would only invite the click. */
.ledger-active{
  font-size:11px;
  font-weight:600;
  letter-spacing:0.03em;
  text-transform:uppercase;
  color:var(--teal);
  padding:6px 7px;
  white-space:nowrap;
}
.ledger-open{
  border:1px solid var(--line-input);
  background:var(--card);
  color:var(--text-dim);
  font-size:11.5px;
  font-weight:600;
  line-height:1;
  padding:6px 10px;
  border-radius:7px;
  cursor:pointer;
  white-space:nowrap;
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.ledger-open:hover{background:var(--paper); color:var(--text); border-color:var(--line);}
.ledger-delete{
  border:none;
  background:transparent;
  color:var(--text-faint);
  font-size:12px;
  line-height:1;
  padding:6px 7px;
  border-radius:6px;
  cursor:pointer;
  transition:background .15s ease, color .15s ease;
}
.ledger-delete:hover:not(:disabled){background:var(--line-soft); color:var(--rust);}
.ledger-delete:disabled{opacity:0.25; cursor:default;}

/* The add rows for rules and accounts. Same separated-footer shape; an account
   is only a name, so it is a column shorter. */
.rule-add,
.ledger-add{
  display:grid;
  gap:8px;
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--line-soft);
}
.rule-add{grid-template-columns:1fr 1fr auto;}
.ledger-add{grid-template-columns:1fr auto;}
.rule-add input,
.ledger-add input{
  font-family:var(--font-body);
  font-size:13px;
  border:1px solid var(--line-input);
  border-radius:9px;
  padding:9px 12px;
  background:var(--paper);
  color:var(--text);
  min-width:0;
}
.rule-add input:focus,
.ledger-add input:focus{outline:2px solid var(--teal); outline-offset:1px;}
/* At the account limit the field is disabled alongside its button. */
.ledger-add input:disabled{opacity:0.5; cursor:default;}

/* ---- Pinned categories ---- */

.overrides-body{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.override-row{
  display:grid;
  grid-template-columns:1fr auto auto;
  gap:10px;
  align-items:center;
  padding:7px 0;
  border-bottom:1px solid var(--line-soft);
  font-size:12.5px;
}
.override-row:last-child{border-bottom:none;}
.override-desc{
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.override-cat{
  font-weight:600;
  color:var(--teal);
}

/* ---- Data ---- */

.data-body{
  margin-top:14px;
  display:flex;
  flex-direction:column;
}
.data-line{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:8px 0;
  border-bottom:1px solid var(--line-soft);
  font-size:12.5px;
}
.data-line:last-of-type{border-bottom:none;}
.data-line span:first-child{color:var(--text-dim);}
.data-line span:last-child{
  font-family:var(--font-mono);
  font-weight:600;
  color:var(--text);
  text-align:right;
  word-break:break-all;
}
