:root {
  --std-row-pad: 6px;
  /* Color defaults that can be overridden by user settings */
  --color-summary-text: #ffffff;
  --color-summary-bg-1: #8a8a8a;
  --color-summary-bg-2: #8ad09a;
  --color-summary-bg-3: #dd757f;
  --color-summary-bg-4: #f2af4d;
  --color-table-summary-row-bg: #bccdd7;
}
/* = ====================================
    SCHRIFTEN – Myriad Pro (einbetten)
    ===================================== */
@font-face { font-family: "Myriad Pro"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/myriad-pro/MyriadPro-Regular.woff2") format("woff2"),
       url("../fonts/myriad-pro/MyriadPro-Regular.woff") format("woff"),
       url("../fonts/myriad-pro/MyriadPro-Regular.otf") format("opentype"); }
@font-face { font-family: "Myriad Pro"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/myriad-pro/MyriadPro-Semibold.woff2") format("woff2"),
       url("../fonts/myriad-pro/MyriadPro-Semibold.woff") format("woff"),
       url("../fonts/myriad-pro/MyriadPro-Semibold.otf") format("opentype"); }
@font-face { font-family: "Myriad Pro"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/myriad-pro/MyriadPro-Bold.woff2") format("woff2"),
       url("../fonts/myriad-pro/MyriadPro-Bold.woff") format("woff"),
       url("../fonts/myriad-pro/MyriadPro-Bold.otf") format("opentype"); }

:root{ --bg:#f5f7fb; --card:#ffffff; --line:#e6eaf2; --ink:#0f1728; --muted:#6b7285; --accent:#4ea8ff; }
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:400 15px/1.5 "Myriad Pro","MyriadPro",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif}
img{max-width:100%;display:block}

.content{margin-left:260px;min-height:100vh;padding:24px}
.top{display:flex;align-items:center;gap:12px;margin:40px 0;}
.top h1{margin:0;font-weight:100; font-size: 24px;}
.logo-small{width:40px;height:auto;}
.top .spacer {flex-grow: 1;}
.top .btn {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  border:1px solid var(--line);background:#fff;padding:8px 12px;border-radius:10px;
  font-family: inherit; font-size: inherit;
  cursor: pointer;
}


.panel{background:#ececec;border:1px solid var(--line);border-radius:16px;padding:24px;margin-bottom:16px}
body.org-page .panel { background: #fff; }

.filters{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 40px;
  margin-bottom: 40px;
  padding: 24px;
  background: #dce3ea;
  border-radius: 12px;
}
.filters label{ display:flex; align-items:center; gap: 8px; }

/* General input styles, will be overridden by .pill-input where applicable */
select, input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="file"] {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  border:1px solid var(--line);background:#fff;padding:8px 12px;border-radius:10px;
  font-family: inherit; font-size: inherit;
}
select {
  cursor: pointer;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 16px 12px;
}
.btn{cursor:pointer; appearance: none; border:1px solid var(--line);background:#fff;padding:8px 12px;border-radius:10px;}
a.btn { text-decoration: none; color: inherit; }
.btn.primary{background:#111723;color:#fff;border-color:#111723}
.summary{display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:16px;margin-bottom:16px;}
.summary .card{background:#fff;border-radius:14px;padding:20px;color: var(--color-summary-text);border: none;box-shadow: 0 4px 12px rgba(0,0,0,0.05);}
.summary .card small{display: block;font-size: 13px;margin-bottom: 8px;opacity: 0.9;text-transform: uppercase;font-weight: 600;}
.summary .card strong{font-size: 28px;font-weight: 700;display: block;}
.summary .card.s-uebertrag { background-color: var(--color-summary-bg-1); }
.summary .card.s-einnahmen { background-color: var(--color-summary-bg-2); }
.summary .card.s-ausgaben { background-color: var(--color-summary-bg-3); }
.summary .card.s-endsaldo { background-color: var(--color-summary-bg-4); }

.summary-filtered {background-color: #dce3ea;padding: 20px;border-radius: 14px;font-size: 18px;text-align: center;}
.table-heading {font-weight: 200;font-size: 24px;margin: 0 0 16px 0;}

.right{text-align:right}
.muted{color:var(--muted)}
.red{color:#b91c1c}
button.icon{border:1px solid var(--line);background:#fff;border-radius:10px;padding:6px 8px;cursor:pointer}
button.icon.danger{border-color:#f3d3d3}

.kb{ width:100%; border-collapse:separate; border-spacing:0 8px; background:transparent }
.kb thead th{ background:#f3f4f6; padding:14px 16px; font-size:12px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:#64748b; border:0; text-align: left; }
.kb thead th.right{ text-align:right }
.kb thead tr th:first-child{ border-top-left-radius:12px; border-bottom-left-radius:12px }
.kb thead tr th:last-child{ border-top-right-radius:12px; border-bottom-right-radius:12px }
.kb:not(.standard-view) tbody tr:nth-child(even) td { background-color: #fafafa; }
.kb tbody td{ background:#ffffff; padding:var(--std-row-pad) 12px; vertical-align:middle; border:0; }
.kb tbody tr td:first-child{ border-top-left-radius:12px; border-bottom-left-radius:12px }
.kb tbody tr td:last-child{ border-top-right-radius:12px; border-bottom-right-radius:12px }
.kb:not(.standard-view) tbody tr:hover td{ background-color: #f1f3f5; }
.kb.has-lines tbody td + td { border-left: 1px solid var(--line); }
.kb tbody tr.summary-row td { background-color: var(--color-table-summary-row-bg); font-weight: 600; }

.kb.standard-view { border-collapse: collapse; border-spacing: 0; border-radius: 12px; overflow: hidden; box-shadow:0 1px 0 rgba(16,24,40,.04); }
.kb.standard-view thead th { border-radius: 0; border-bottom: 1px solid var(--line); }
.kb.standard-view tbody td { padding: var(--std-row-pad) 16px; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line); }
.kb.standard-view tbody tr:last-child td { border-bottom: 0; }
.kb.standard-view tbody tr:hover td { background-color: #f1f3f5; box-shadow: none; }
.kb.standard-view tbody tr.summary-row td { background-color: var(--color-table-summary-row-bg); }
.kb.standard-view tbody tr:nth-child(even):not(.summary-row) td { background-color: #fafafa; }

/* --- Modal Styles --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-overlay.hidden { display: none !important; }
.modal { background: #fff; border-radius: 16px; width: 90%; max-width: 600px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-weight: 600; }
.close-button { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.modal-content { padding: 24px; }
.modal-content .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-content label { display: flex; flex-direction: column; gap: 6px; }
.modal-content input, .modal-content select { width: 100%; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--line); text-align: right; }

/* --- Settings Page --- */
.currency-converter { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; align-items: start; }
.currency-converter .rates, .currency-converter .calculator { display: flex; flex-direction: column; gap: 12px; }
.currency-converter label { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 8px; }
.currency-converter input { width: 100%; text-align: right; }

/* --- Organisation Page --- */
body.org-page {
  --line: #979aa2; /* Override the default line color for this page */
}
.organisation-form .form-section { margin-bottom: 32px; }
.organisation-form .form-section h3 { font-weight: 600; margin: 0 0 16px 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.organisation-form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: end;}
.organisation-form label { display: flex; flex-direction: column; gap: 6px; }
.organisation-form .interval-group { display: flex; align-items: center; gap: 8px; }
.organisation-form .interval-input { width: 80px; }
.organisation-form .form-footer { margin-top: 24px; text-align: right; }
.form-group-with-button { display: flex; gap: 8px; align-items: flex-end; }
.form-group-with-button label { flex-grow: 1; }
.add-btn { flex-shrink: 0; height: 37px; width: 37px; cursor: pointer; appearance: none; border:1px solid var(--line);background:#fff;padding:8px;border-radius:10px; font-size: 18px; line-height: 1; }

.pill-input {
  background: #fff;
  border: 1px solid #aaaaac;
  border-radius: 16px;
  padding: 14px 16px;
  height: 48px;
  font: inherit;
}
.pill-input::placeholder{ color:#9aa3af }


@media (max-width:960px){
  .content{margin-left:0;padding:16px}
  .currency-converter { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .modal-content .grid-2 { grid-template-columns: 1fr; }
  .organisation-form .grid-2 { grid-template-columns: 1fr; }
}

/* --- Automated rules as cards --- */
.rule-list{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:16px; }
@media (max-width: 1200px){ .rule-list{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px){ .rule-list{ grid-template-columns: 1fr; } }

.rule-card{ border:1px solid var(--line); background:#fff; border-radius:16px; padding:16px 18px; box-shadow:0 6px 24px rgba(16,24,40,.06); }
.rule-card.on{}
.rule-card.off{ opacity:.9 }
.rule-main{ display:flex; align-items:center; gap:12px; font-weight:700; font-size:18px; margin-bottom:6px }
.rule-main .title{ line-height:1.2 }
.badge{ display:inline-block; padding:6px 10px; border-radius:999px; font-size:12px }
.badge.ok{ background:#0f172a; color:#fff }
.badge.muted{ background:#e5e7eb; color:#111827 }
.rule-sub{ color:#475569; display:flex; align-items:center; gap:8px; margin-bottom:10px }
.rule-actions{ display:flex; align-items:center; gap:12px }

/* Toggle switch button */
.switch{ position:relative; display:inline-block; width:50px; height:28px; border-radius:999px; border:1px solid var(--line); background:#f1f5f9; cursor:pointer }
.rule-card.on .switch{ background:#111827 }
.switch span{ position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%; background:#fff; transition:transform .2s ease }
.rule-card.on .switch span{ transform:translateX(22px) }
.switch:focus{ outline:none; box-shadow:0 0 0 3px rgba(59,130,246,.25) }

@media (max-width:640px){
  .rule-card{ padding:14px }
}

.icon.edit{border:1px solid var(--line);background:#fff;border-radius:10px;padding:6px 8px;cursor:pointer;margin-right:6px}
.icon.edit:hover{box-shadow:0 2px 10px rgba(16,24,40,.08)}

/* Actions cell: pencil + trash side-by-side */
td.actions{ text-align:right; white-space:nowrap; }
td.actions form{ display:inline; margin:0; }

/* --- Dashboard Specific Styles --- */
.dashboard-header {
    margin-bottom: 24px;
}
.dashboard-panel {
    background-color: transparent;
    border: none;
    padding: 0;
}
.cash-balance-bar {
    background-color: #9cb68c;
    color: #fff;
    border-radius: 14px;
    padding: 20px 24px;
    text-align: center;
    margin-bottom: 24px;
}
.cash-balance-bar span {
    display: block;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.9;
}
.cash-balance-bar strong {
    display: block;
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}
.secondary-stats {
    margin-top: 24px;
}
.dash-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dash-card small {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
}
.dash-card span {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-card strong {
    font-size: 24px;
    font-weight: 700;
}
.group-summaries {
    margin-top: 40px;
}
.group-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
@media (min-width: 1024px) {
    .group-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.group-summary-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--line);
}
.group-summary-card h4 {
    margin: 0 0 16px 0;
    font-weight: 600;
}
.group-stats {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.group-stats > div {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
}
.group-stats .stat-income {
    background-color: #f0fff4; /* pastel-green */
}
.group-stats .stat-expense {
    background-color: #fff5f5; /* pastel-red */
}
.group-stats small {
    font-size: 12px;
    color: var(--muted);
}
.group-stats strong {
    font-size: 18px;
    font-weight: 600;
    display: block;
}
.group-stats .stat-income strong {
    color: #22c55e; /* green */
}
.group-stats .stat-expense strong {
    color: #ef4444; /* red */
}

/* ====================================
   TABLE COLUMN WIDTHS & STYLES
   ==================================== */

/* --- Column Sizing & Alignment --- */
.kb .col-actions {
    width: 90px;
    min-width: 90px;
}

.kb .col-doc {
    width: 80px;
    min-width: 80px;
    text-align: center;
}

.kb .col-fx {
    width: 140px;
    min-width: 140px;
}

/* This targets the div inside the FX td to limit lines and wrapping */
.kb td.col-fx > div {
    font-size: 0.8em;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
}
.kb td.col-fx > div > span {
    display: block;
}
