:root {
  --bg: #262e3a;
  --bg-alt: #2c3544;
  --bg-panel: #313b4c;
  --border: #414c60;
  --border-light: #56637c;
  --text: #f1f3f6;
  --text-dim: #aab4c4;
  --text-faint: #7c8798;

  --navy: #0a3fa0;
  --navy-light: #5a8af2;
  --green: #16c93a;
  --green-light: #3ddb63;
  --red: #e0473f;
  --red-light: #ff6b62;
  --amber: #d9a13a;

  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

  --wrap: 1180px;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 24px 20px 80px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-alt);
  border-bottom: 3px solid var(--navy);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand img { height: 36px; width: auto; display: block; }

.topbar-brand .title {
  font-family: var(--font-display);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- View toggle ---------- */

.view-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.view-toggle button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.view-toggle button.active {
  background: var(--navy);
  color: #fff;
}

.view-toggle button[data-mode="ic"].active {
  background: var(--amber);
  color: #241b04;
}

/* ---------- Buttons ---------- */

button, .btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--bg-panel);
  color: var(--text);
  padding: 9px 16px;
  cursor: pointer;
  transition: filter .15s, background .15s;
}

button:hover, .btn:hover { filter: brightness(1.12); }
button:active, .btn:active { filter: brightness(0.95); }

.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-green { background: var(--green); border-color: var(--green); color: #062b0d; }
.btn-outline { background: transparent; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red-light); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 6px 9px; line-height: 1; }

input[type="file"] { display: none; }

/* ---------- Panels ---------- */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Form grid ---------- */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 20px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 5px;
}

input[type="text"], input[type="date"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 10px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-light);
}

/* ---------- Items table ---------- */

.items-table-wrap { overflow-x: auto; }

table.items {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

table.items th {
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  padding: 8px 8px;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

table.items td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.items td input {
  padding: 7px 8px;
  font-size: 13.5px;
}

table.items td.num { text-align: right; }
table.items input.num-input { text-align: right; }

td.col-urun { min-width: 260px; }
td.col-sira { width: 34px; color: var(--text-faint); font-family: var(--font-mono); text-align: center; }
th.col-fiyat, th.col-toplam { width: 132px; }
input.fiyat-input { max-width: 112px; }

.ic-only { background: rgba(217, 161, 58, 0.08); }
th.ic-only, td.ic-only { background: rgba(217, 161, 58, 0.08); }

.row-total { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }

.teslim-cell { display: flex; gap: 6px; align-items: center; }
.teslim-cell input.teslim-sayi { width: 56px; flex: none; }
.teslim-cell select.teslim-birim { width: auto; flex: 1; min-width: 92px; }
.row-profit-pos { color: var(--green-light); }
.row-profit-neg { color: var(--red-light); }

.items-foot {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- Summary ---------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.summary-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.summary-card .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.summary-card .value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
}

.summary-card.total .value { color: var(--navy-light); }
.summary-card.profit .value { color: var(--green-light); }

/* ---------- Customer list ---------- */

.customer-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.customer-empty { color: var(--text-faint); font-size: 13px; padding: 4px 0; }

.customer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.customer-row-info { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.customer-row-info .firma { font-weight: 600; }
.customer-row-info .kisi { color: var(--text-dim); font-size: 13px; }
.customer-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Saved quotes (history) list ---------- */

.history-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.history-row-info { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.history-row-info .history-no { font-family: var(--font-mono); font-weight: 600; color: var(--navy-light); }
.history-row-info .history-firma { font-weight: 600; }
.history-row-info .history-teklifadi { color: var(--text-dim); font-size: 12.5px; }
.history-row-info .history-date { color: var(--text-faint); font-size: 12.5px; }
.history-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.customer-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.customer-form input { flex: 1; min-width: 160px; width: auto; }

/* ---------- Scope of work ---------- */

.scope-panel textarea { resize: vertical; min-height: 88px; line-height: 1.5; }

/* ---------- Terms list ---------- */

.terms-list { display: flex; flex-direction: column; gap: 8px; }

.term-row { display: flex; align-items: center; gap: 8px; }
.term-row input { flex: 1; }

.terms-foot { margin-top: 10px; }

/* ---------- Footer note ---------- */

.footer-note {
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
  margin-top: 30px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(217, 161, 58, 0.18);
  color: var(--amber);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .grid-2, .grid-3, .summary-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
