/* MaritimeOS arayüzü. Orontes OS görsel dili (çekirdekteki web/src/styles.css ile aynı değişkenler):
   mürekkep koyusu, nehir yeşili, alüvyon sarısı; ince çizgi, gölgesiz yüzey, tablo rakamları. */
:root {
  --ink: #10222b; --ink-2: #44565f; --ink-3: #74858d;
  --paper: #f1f4f4; --card: #ffffff; --sunk: #f6f8f8; --line: #dbe3e4; --line-2: #c5d0d2;
  --river: #0e6b73; --river-2: #0a545b; --river-soft: #e1f0f0;
  --silt: #b9791c; --silt-soft: #f8edd8;
  --ok: #1c7748; --ok-soft: #e0f1e7; --warn: #a8650a; --warn-soft: #faeed6; --bad: #b3311f; --bad-soft: #fae6e2; --info: #235f9c; --info-soft: #e2edf8;
  --display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 6px; --r-md: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e4ecee; --ink-2: #a9b9bf; --ink-3: #7c8e95;
    --paper: #0b1418; --card: #121e24; --sunk: #0f1a1f; --line: #21333a; --line-2: #2e434b;
    --river: #4fbac1; --river-2: #7bd0d6; --river-soft: #12333a;
    --silt: #e2ab4e; --silt-soft: #33280f;
    --ok: #55c08a; --ok-soft: #12301f; --warn: #e5a83f; --warn-soft: #33270d; --bad: #f0806e; --bad-soft: #3a1a15; --info: #78b0ea; --info-soft: #14283d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14.5px/1.5 var(--body); background: var(--card); color: var(--ink); -webkit-font-smoothing: antialiased; }
#app { padding: 4px 2px 40px; max-width: 1280px; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 10px; }
a { color: var(--river); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-2); } .small { font-size: 13px; } .pad { padding: 16px; } .num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.hidden { display: none !important; }

/* Üst şerit: sekmeler + eylemler */
.bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 14px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); width: 100%; margin-bottom: 14px; }
.tabs a { padding: 8px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--river); border-bottom-color: var(--river); }
.tabs .count { font-size: 12px; background: var(--sunk); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; margin-left: 5px; color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.seg a { padding: 5px 11px; color: var(--ink-2); font-size: 13.5px; border-right: 1px solid var(--line-2); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--river-soft); color: var(--river); font-weight: 500; }
.seg a:hover { text-decoration: none; }

/* Düğmeler */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: 500 14px var(--body); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--river); outline-offset: 1px; }
.btn-primary { background: var(--river); border-color: var(--river); color: #fff; }
.btn-primary:hover { background: var(--river-2); border-color: var(--river-2); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #06262a; } }
.btn-danger { color: var(--bad); border-color: var(--bad); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-big { height: 40px; padding: 0 16px; font-size: 15px; }

/* Kart ve tablo */
.card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); }
.card > .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card > .body { padding: 14px; }
.card.flat > .body { padding: 0; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-2); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--sunk); }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--sunk); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { background: var(--sunk); font-weight: 500; }
.empty { padding: 34px 16px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 16px; margin-bottom: 4px; }

/* Rozetler */
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: var(--sunk); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.river { background: var(--river-soft); color: var(--river); border-color: transparent; }

/* İstatistik karoları */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.stat .k { font-size: 12.5px; color: var(--ink-2); }
.stat .v { font: 600 22px var(--display); font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .s { font-size: 12.5px; color: var(--ink-3); }

/* Akış şeridi: teklif → iş emri → fatura */
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 8px; align-items: stretch; margin-bottom: 14px; }
.flow .step { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; min-width: 0; }
.flow .step .k { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.flow .step .v { font: 600 15px var(--display); }
.flow .step.done { background: var(--river-soft); border-color: transparent; }
.flow .step.cur { border: 2px solid var(--river); padding: 9px 11px; }
.flow .step.todo { border-style: dashed; color: var(--ink-2); }
.flow .arrow { align-self: center; color: var(--ink-3); }
@media (max-width: 640px) { .flow { grid-template-columns: 1fr; } .flow .arrow { display: none; } }

/* Tanım listesi */
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 18px; }
.dl div .k { font-size: 12.5px; color: var(--ink-2); }
.dl div .v { font-weight: 500; overflow-wrap: anywhere; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.note { border-left: 3px solid var(--silt); background: var(--silt-soft); padding: 9px 12px; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 13.5px; white-space: pre-line; }
.note.info { border-color: var(--info); background: var(--info-soft); }
.note.bad { border-color: var(--bad); background: var(--bad-soft); }
.note.ok { border-color: var(--ok); background: var(--ok-soft); }
pre.mail { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13.5px/1.55 var(--body); background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; max-height: 320px; overflow: auto; }

/* Formlar */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .f { grid-column: span 2; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form .f.half { grid-column: span 1; }
@media (max-width: 560px) { .form .f.half { grid-column: span 2; } }
label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
input, select, textarea { font: 14.5px var(--body); color: var(--ink); background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 7px 9px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
input[type="checkbox"] { width: auto; }
.help { font-size: 12.5px; color: var(--ink-3); }
.err { color: var(--bad); font-size: 13.5px; }
td input, td select { padding: 5px 7px; font-size: 14px; }

/* Pencere */
.modal-back { position: fixed; inset: 0; background: rgba(8, 16, 20, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow: auto; z-index: 50; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); width: min(660px, 100%); }
.modal.wide { width: min(860px, 100%); }
.modal > header { padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal > .body { padding: 16px; }
.modal > footer { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.x { background: none; border: 0; font-size: 20px; line-height: 1; color: var(--ink-2); cursor: pointer; padding: 2px 6px; }

/* Bildirim şeritleri */
#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 28px)); }
.toast { background: var(--ink); color: var(--card); padding: 10px 13px; border-radius: var(--r-sm); font-size: 14px; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* Yatay çubuk grafik */
.bars { display: grid; gap: 7px; }
.bars .b { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.bars .b .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b .track { height: 10px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.bars .b .fill { height: 100%; background: var(--river); border-radius: 99px; min-width: 2px; }
.bars .b .fill.silt { background: var(--silt); }
.bars .b .fill.bad { background: var(--bad); }

/* Liman çağrısı ve acente kartları */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.pc { border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 14px; display: flex; flex-direction: column; gap: 8px; }
.pc h3 { font-size: 16px; }

/* Harita */
.map { width: 100%; height: auto; display: block; background: var(--sunk); border-radius: var(--r-md); }
.map .sea-line { stroke: var(--line); stroke-width: 0.6; }
.map .port { fill: var(--card); stroke: var(--ink-2); stroke-width: 1.2; }
.map .ship { fill: var(--river); }
.map .leg { stroke: var(--river); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.map text { font: 10px var(--body); fill: var(--ink-2); }
.map text.v { fill: var(--ink); font-weight: 600; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 99px; margin-right: 5px; }
.dot.valid { background: var(--ok); } .dot.soon { background: var(--silt); } .dot.urgent { background: var(--warn); } .dot.expired { background: var(--bad); } .dot.pending { background: var(--ink-3); }
tr.band-expired td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.band-urgent td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.band-soon td:first-child { box-shadow: inset 3px 0 0 var(--silt); }
