:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e5e7eb;
  --shadow:0 10px 30px rgba(2,6,23,.08);
  --radius:16px;
  --radius-sm:12px;
  --primary:#0c4aad;
  --primary-2:#1d6cff;
  --danger:#dc2626;
  --success:#16a34a;
  --chip:#f1f5ff;
  --chip-text:#0b2e73;
  --focus:0 0 0 4px rgba(29,108,255,.18);
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  --font-rtl: "K24KurdishBold", var(--font);
}

:root[data-theme="dark"]{
  --bg:#0b1220;
  --card:#0f1a2d;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --line:#1f2b44;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --chip:#0b244a;
  --chip-text:#cfe3ff;
  --focus:0 0 0 4px rgba(29,108,255,.25);
}

@font-face{
  font-family:"K24KurdishBold";
  src:url("fonts/K24KurdishBold-Bold.ttf") format("truetype");
  font-weight:700;
  font-style:normal;
  font-display:swap;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:var(--bg);
}
:root[dir="rtl"] body{
  font-family:var(--font-rtl);
}

.app{ max-width:1020px; margin:24px auto 60px; padding:0 16px; }
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:22px;
  padding:12px 14px;
  box-shadow:var(--shadow);
  position:sticky;
  top:10px;
  z-index:10;
  backdrop-filter:saturate(130%) blur(6px);
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:240px;
}
.brand img{
  width:40px; height:40px; border-radius:12px;
  border:1px solid var(--line);
}
.brand .title{
  display:flex; flex-direction:column; line-height:1.15;
}
.brand .title strong{ font-size:16px; }
.brand .title small{ font-size:12px; color:var(--muted); }

.toolbar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.seg{
  display:inline-flex;
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:999px;
  padding:3px;
  gap:3px;
}
.seg button{
  border:0;
  background:transparent;
  padding:7px 10px;
  border-radius:999px;
  font-weight:700;
  font-size:12px;
  color:var(--muted);
  cursor:pointer;
}
.seg button[aria-pressed="true"]{
  background:var(--card);
  color:var(--text);
  box-shadow:0 6px 16px rgba(2,6,23,.08);
}
.btn{
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text);
  border-radius:999px;
  padding:9px 12px;
  font-weight:800;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.btn.primary{
  background:linear-gradient(180deg, var(--primary-2), var(--primary));
  border-color:rgba(255,255,255,.08);
  color:white;
}
.btn.danger{
  border-color:rgba(220,38,38,.4);
  color:var(--danger);
  background:transparent;
}
.btn:focus, .seg button:focus, input:focus, select:focus{
  outline:none;
  box-shadow:var(--focus);
}

.grid{
  display:grid;
  gap:16px;
  margin-top:16px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:var(--shadow);
  padding:18px;
}
.card h2{
  margin:0 0 12px;
  font-size:18px;
}
.row{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-end;
}
.col{
  flex:1 1 280px;
  min-width:220px;
}
label{
  display:block;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
  margin:0 0 6px;
}
input, select{
  width:100%;
  border:1px solid var(--line);
  background:transparent;
  color:var(--text);
  border-radius:14px;
  padding:12px 12px;
  font-size:14px;
  font-weight:700;
}
input::placeholder{ color:rgba(100,116,139,.8); font-weight:600; }
.hint{
  font-size:12px;
  color:var(--muted);
  margin-top:6px;
}

.savedBox{
  border:1px dashed var(--line);
  border-radius:16px;
  padding:10px 12px;
  color:var(--muted);
  font-weight:700;
  font-size:13px;
}
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:rgba(29,108,255,.08);
  border:1px solid rgba(29,108,255,.18);
  padding:9px 12px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  margin-top:10px;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}
.chip{
  border:1px solid rgba(29,108,255,.18);
  background:var(--chip);
  color:var(--chip-text);
  border-radius:999px;
  padding:7px 10px;
  font-weight:900;
  font-size:12px;
  cursor:pointer;
}

.summary{
  margin-top:12px;
  border:1px solid var(--line);
  border-radius:16px;
  padding:10px 12px;
  font-weight:900;
  background:linear-gradient(180deg, rgba(29,108,255,.06), rgba(29,108,255,.02));
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:16px;
}
thead th{
  text-align:left;
  font-size:12px;
  color:var(--muted);
  padding:10px 10px;
  background:rgba(100,116,139,.08);
  border-bottom:1px solid var(--line);
}
:root[dir="rtl"] thead th{ text-align:right; }
tbody td{
  padding:10px 10px;
  border-bottom:1px solid var(--line);
  font-weight:700;
  font-size:13px;
  vertical-align:top;
}
tbody tr:last-child td{ border-bottom:0; }
.actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.mini{
  padding:7px 10px;
  font-size:12px;
  font-weight:900;
}

.rangeRow{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  margin:8px 0 12px;
}

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  background:var(--card);
  border:1px solid var(--line);
  border-radius:999px;
  box-shadow:var(--shadow);
  padding:10px 12px;
  display:none;
  align-items:center;
  gap:10px;
  z-index:50;
}
.toast.show{ display:flex; }

/* Print */
.printArea{ display:none; }
@media print{
  body{ background:#fff; }
  .app{ margin:0; padding:0; }
  .topbar, .card, .toast{ display:none !important; }
  .printArea{ display:block !important; padding:18mm; }
  .receipt{
    border:1px solid #ddd;
    border-radius:14px;
    padding:16px;
    font-family: Arial, sans-serif;
  }
  .rHead{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:12px;
  }
  .rHead .rTitle{ font-size:18px; font-weight:800; }
  .rMeta{ font-size:12px; color:#444; }
  .rGrid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px; }
  .rBox{ border:1px solid #e5e7eb; border-radius:12px; padding:10px; }
  .rBox .k{ font-size:11px; color:#555; font-weight:700; }
  .rBox .v{ font-size:16px; font-weight:900; margin-top:4px; }
  .rLine{ margin-top:12px; font-size:12px; color:#444; }
}

/* ===== Transaction History Controls UI Fix ===== */
.history-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-controls select,
.history-controls button {
  height: 40px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.history-controls button {
  background: #fff;
  border: 1px solid #d0d7e2;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-controls button:hover {
  background: #f5f8ff;
  border-color: #2f6bff;
}

.history-controls select {
  min-width: 110px;
  background: #fff;
  border: 1px solid #d0d7e2;
}

[data-theme="dark"] .history-controls button,
[data-theme="dark"] .history-controls select {
  background: #161b22;
  border-color: #30363d;
  color: #e6edf3;
}
/* ===== End Fix ===== */


/* ===== v2.0.2 Transaction History Toolbar Alignment Fix =====
   Ensures Range select + Clear/Export/Import are same height and aligned in one row.
*/
.rangeRow > select,
.rangeRow > .btn.mini,
.rangeRow > label.btn.mini {
  height: 40px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Keep dropdown readable while matching height */
.rangeRow > select{
  min-width: 170px;
}

/* Hover feel (consistent) */
.rangeRow > .btn.mini:hover,
.rangeRow > label.btn.mini:hover {
  background: #f5f8ff;
  border-color: #2f6bff;
}

/* Dark mode */
[data-theme="dark"] .rangeRow > .btn.mini:hover,
[data-theme="dark"] .rangeRow > label.btn.mini:hover {
  background: rgba(47,107,255,0.12);
  border-color: #2f6bff;
}
/* ===== End v2.0.2 Fix ===== */


/* ===== v2.0.3 Import Button Alignment Fix ===== */
.rangeRow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rangeRow > * {
  flex-shrink: 0;
}

.rangeRow label.btn.mini {
  margin: 0;
}
/* ===== End v2.0.3 Fix ===== */


/* ===== v2.0.4 Daily Market Rate Row Fix + Remove Rate Chips ===== */
.rateGrid, .rateRow, .rateWrap {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.rateGrid > .col, .rateRow > .col, .rateWrap > .col {
  flex: 1 1 320px;
}

.rateGrid .savedBox, .rateRow .savedBox, .rateWrap .savedBox,
#rateSaved, #savedRateBox, .rateSavedBox {
  width: 100%;
}

.rateGrid .fieldRow, .rateRow .fieldRow, .rateWrap .fieldRow {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Ensure Save/Clear sit nicely under the input */
.rateActions, .rateBtns {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Mobile: stack cleanly */
@media (max-width: 720px) {
  .rateGrid, .rateRow, .rateWrap {
    flex-direction: column;
  }
}
/* ===== End v2.0.4 Fix ===== */
