/* ==========================================================================
   Bank CRM - back office for the online bank
   White workspace, brand green (#006a4d) sidebar and actions.
   ========================================================================== */

:root {
  --bg:          #ffffff;
  --surface:     #ffffff;
  --surface-2:   #f5f8f7;
  --line:        #e1e8e5;
  --line-strong: #c9d4cf;

  --ink:   #11201b;
  --ink-2: #4a5a55;
  --ink-3: #7d8c87;

  --brand:      #006a4d;
  --brand-dark: #00553d;
  --on-brand:   #ffffff;
  --on-brand-2: rgba(255, 255, 255, .78);
  --on-brand-3: rgba(255, 255, 255, .6);

  --accent:      #006a4d;
  --accent-dark: #00553d;
  --accent-soft: #e6f2ee;
  --accent-ring: rgba(0, 106, 77, .18);
  --hover-row:   #f3f8f6;

  --ok:       #0f9d58;
  --ok-soft:  #e5f6ed;
  --err:      #d93636;
  --err-soft: #fdecec;
  --warn:     #b7791f;
  --warn-soft:#fdf5e4;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(17, 32, 27, .04), 0 1px 3px rgba(17, 32, 27, .05);
  --shadow-lg: 0 10px 30px rgba(17, 32, 27, .08);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.55 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
small { font-size: 12px; }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-size: .93em; }
.muted { color: var(--ink-3); }
.strong { font-weight: 650; }
.pos { color: var(--ok); }
.neg { color: var(--err); }
.nowrap { white-space: nowrap; }
.sub { margin: 4px 0 0; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; }
.hint.pad { padding: 0 20px 16px; }
.spaced { margin-top: 18px !important; }

/* ---------- app shell ---------- */
body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--brand); color: var(--on-brand);
  padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: #fff; color: var(--brand); flex: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.brand-mark.big { width: 54px; height: 54px; border-radius: 14px; }
.brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-text small { font-weight: 500; color: var(--on-brand-2); font-size: 11.5px; margin-top: 2px; }

.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label {
  margin: 16px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--on-brand-3);
}
.side nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px;
  color: var(--on-brand-2); font-weight: 500;
}
.side nav a svg { color: var(--on-brand-3); flex: none; }
.side nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.side nav a:hover svg { color: #fff; }
.side nav a.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.side nav a.active svg { color: var(--brand); }

.side-foot { border-top: 1px solid rgba(255, 255, 255, .16); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.who { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; color: #fff; }
.who:hover, .who.active { background: rgba(255, 255, 255, .1); text-decoration: none; color: #fff; }
.who span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--on-brand-2); }
.signout { padding: 6px 8px; color: var(--on-brand-2); font-size: 13px; }
.signout:hover { color: #fff; }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
}
.avatar.soft { background: var(--accent-soft); color: var(--accent-dark); width: 32px; height: 32px; font-size: 13px; }
.side .avatar { background: #fff; color: var(--brand); }

.main { min-width: 0; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 28px 32px 60px; }

/* ---------- page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mono-title { font-family: var(--mono); font-size: 22px; letter-spacing: 0; }

.person { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.person:hover { text-decoration: none; }
.person > span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.person small { color: var(--ink-3); }
.person.big { gap: 14px; }
.person.big .avatar { width: 52px; height: 52px; font-size: 20px; }
a.person:hover strong { color: var(--accent); }

/* ---------- notices & pills ---------- */
.notice {
  padding: 11px 14px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; font-size: 13.5px;
}
.notice.ok   { background: var(--ok-soft);   border-color: #b9e5cc; color: #0b6b3d; }
.notice.warn { background: var(--warn-soft); border-color: #f2dca9; color: #7a4f0b; }
.notice.err  { background: var(--err-soft);  border-color: #f5c2c2; color: #9b2222; }
.notice.info { background: var(--accent-soft); border-color: #b5d6cb; color: var(--accent-dark); }
.notice a { color: inherit; text-decoration: underline; font-weight: 600; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  line-height: 1.6; white-space: nowrap;
}
.pill-ok     { background: var(--ok-soft); color: #0b7a44; }
.pill-err    { background: var(--err-soft); color: #b42727; }
.pill-warn   { background: var(--warn-soft); color: #8a5a0e; }
.pill-info   { background: #fff; color: var(--accent-dark); box-shadow: inset 0 0 0 1px #9fc9ba; }
.pill-accent { background: var(--brand); color: #fff; }
.pill-muted  { background: #eef2f0; color: var(--ink-2); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.card-head a { font-size: 13px; font-weight: 600; }
.card-title { margin: 0 0 14px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-title .muted { font-weight: 500; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title-row .card-title { margin: 0; }
.empty { padding: 34px 20px; margin: 0; text-align: center; color: var(--ink-3); }

.success-card { border-color: #b9e5cc; background: linear-gradient(180deg, #f3fbf6, #fff 60%); }
.success-card h3 { color: #0b6b3d; }
.success-card p { margin: 6px 0 14px; color: var(--ink-2); }
.creds {
  display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0;
  padding: 14px 16px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px;
}
.creds dt { color: var(--ink-3); }
.creds dd { margin: 0; font-weight: 600; word-break: break-all; }

.danger-zone { border-color: #f1caca; }
.danger-zone .card-title { color: #9b2222; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-word; }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.plain-list small { color: var(--ink-3); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line-strong); }
.stat-accent::before { background: var(--accent); }
.stat-pos::before { background: var(--ok); }
.stat-neg::before { background: var(--err); }
.stat-label { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.stat-value { display: block; font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-accent .stat-value { color: var(--accent-dark); }
.stat-sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- layout helpers ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.col-main, .col-side { min-width: 0; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data th .muted { font-weight: 500; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--hover-row); }
table.data th:first-child, table.data td:first-child { padding-left: 20px; }
table.data th:last-child, table.data td:last-child { padding-right: 20px; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.pos, table.data td.neg { font-weight: 600; }
table.data td small { color: var(--ink-3); }
tr.row-link { cursor: pointer; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-detail { font-size: 12.5px; color: var(--ink-2); min-width: 320px; word-break: break-word; }

table.data.raw td { font-family: var(--mono); font-size: 12px; white-space: nowrap; padding: 8px 12px; }
table.data.raw th { font-family: var(--mono); font-size: 11px; }

.people { list-style: none; margin: 0; padding: 6px 0; }
.people a { display: flex; align-items: center; gap: 12px; padding: 9px 20px; color: var(--ink); }
.people a:hover { background: var(--hover-row); text-decoration: none; }
.people-main, .people-side { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.people-main { flex: 1; }
.people-side { text-align: right; }
.people small { color: var(--ink-3); }

.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin: -6px 0 18px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-grid .field { margin-bottom: 0; }
.field.wide { grid-column: 1 / -1; }
label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
label .muted { font-weight: 500; }
.req { color: var(--err); }

input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search],
input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); width: 100%;
  padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input.mono, textarea.mono { font-family: var(--mono); font-size: 13px; }
input::placeholder, textarea::placeholder { color: #a5b0c0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input.compact { width: 220px; padding: 7px 11px; }
textarea { resize: vertical; min-height: 64px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset[disabled] input, fieldset[disabled] select { background: var(--surface-2); color: var(--ink-2); }

.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.checks.stack { flex-direction: column; gap: 9px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.check.small { font-size: 11.5px; color: var(--ink-3); gap: 5px; }
.check.small input { width: 13px; height: 13px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.segmented label { margin: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 8px 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); background: #fff; }
.segmented label + label span { border-left: 1px solid var(--line-strong); }
.segmented input:checked + .seg-pos { background: var(--ok-soft); color: #0b7a44; }
.segmented input:checked + .seg-neg { background: var(--err-soft); color: #b42727; }
.segmented input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 16px; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field.grow { flex: 1 1 240px; }
.filter-buttons { display: flex; gap: 8px; }

details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h3::before { content: "+"; display: inline-block; width: 18px; color: var(--accent); font-weight: 700; }
details.card[open] > summary { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
details.card[open] > summary h3::before { content: "−"; }
details.card > summary .hint { margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap;
  padding: 9px 15px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(0, 106, 77, .25);
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; text-decoration: none; }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn-light:hover { background: var(--surface-2); color: var(--ink); border-color: #b9c3d2; }
.btn-danger { background: var(--err); border-color: var(--err); }
.btn-danger:hover { background: #b92b2b; border-color: #b92b2b; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.actions.stack { flex-direction: column; align-items: stretch; margin-top: 0; }
.actions.stack form { width: 100%; }

/* ---------- transaction edit ---------- */
.current {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; margin-bottom: 14px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2);
}
.current strong { font-size: 17px; }
.current > span:first-child { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }

/* ---------- sharing list ---------- */
.share-list { border: 1px solid var(--line); border-radius: 10px; max-height: 460px; overflow-y: auto; }
.share-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 400; color: var(--ink); }
.share-item:last-child { border-bottom: 0; }
.share-item:hover { background: var(--hover-row); }
.share-item input { accent-color: var(--accent); width: 16px; height: 16px; }
.share-item > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.share-item small { color: var(--ink-3); }

/* ---------- database tables ---------- */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.table-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.table-tile:hover { border-color: var(--accent); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-lg); }
.table-tile .mono { font-weight: 600; font-size: 13px; }
.table-tile small { color: var(--ink-3); }
.table-tile.empty-tile { background: var(--surface-2); }
.table-tile.empty-tile .mono { color: var(--ink-2); font-weight: 500; }

/* ---------- site notice preview ---------- */
.bank-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f4f7fb; }
.bank-preview-bar { display: flex; gap: 6px; padding: 9px 12px; background: #e9eef5; border-bottom: 1px solid var(--line); }
.bank-preview-bar span { width: 10px; height: 10px; border-radius: 50%; background: #cdd6e3; }
.bank-preview-body { padding: 16px; }
.bank-notice {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 8px;
  background: #ffc107; color: #3b2a00; font-weight: 600; transition: opacity .2s;
}
.bank-notice.is-off { opacity: .3; }
.bank-notice-icon { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #3b2a00; color: #ffc107; font-weight: 800; }
.bank-preview-lines { display: grid; gap: 8px; margin-top: 16px; }
.bank-preview-lines i { display: block; height: 10px; border-radius: 5px; background: #dde4ee; }
.bank-preview-lines i:nth-child(2) { width: 80%; }
.bank-preview-lines i:nth-child(3) { width: 55%; }

/* ---------- login ---------- */
body.plain { background: var(--bg); }
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.login-art {
  display: grid; place-items: center; padding: 48px; color: var(--on-brand);
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(255, 255, 255, .12), transparent 60%),
    radial-gradient(500px 400px at 90% 100%, rgba(0, 0, 0, .18), transparent 60%),
    var(--brand);
}
.login-art-inner { max-width: 380px; }
.login-art h2 { color: #fff; font-size: 30px; margin: 22px 0 10px; letter-spacing: -.02em; }
.login-art p { color: var(--on-brand-2); font-size: 15px; margin: 0 0 24px; }
.login-art ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.login-art li { position: relative; padding-left: 28px; color: var(--on-brand); }
.login-art li::before {
  content: "✓"; position: absolute; left: 0; top: 0; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; background: #fff; color: var(--brand); font-weight: 700;
}
.login-form { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 26px; }
.login-card .sub { margin-bottom: 24px; }
.login-card .field { margin-bottom: 14px; }
.login-card input { padding: 10px 12px; }
.login-card .btn { margin-top: 6px; padding: 11px 15px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-2, .layout-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  body.app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 12px 16px; }
  .brand { padding-bottom: 10px; }
  .side nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav-label { display: none; }
  .side nav a { padding: 7px 10px; font-size: 13px; }
  .side-foot { flex-direction: row; justify-content: space-between; align-items: center; margin-top: 10px; }
  .wrap { padding: 20px 16px 48px; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  input.compact { width: 100%; }
  .filter-buttons { width: 100%; }
}
