/* MarinERP uygulama arayüzü. Renkler site ile aynı marka sisteminden (docs/03-web-sitesi.md §7). */

:root {
  --navy: #0E2233;
  --accent: #C8461E;
  --accent-text: #A93A18;
  --on-accent: #FFFFFF;
  --bg: #F5F3EE;
  --surface: #FFFFFF;
  --surface-2: #FAF8F4;
  --ink: #0E2233;
  --muted: #5B6B78;
  --line: #DED8CC;
  --line-soft: #ECE7DD;
  --ok: #1F7A4D;
  --ok-bg: #E4F2EA;
  --bad: #A33A2A;
  --bad-bg: #F8E6E2;
  --side-bg: #0E2233;
  --side-ink: #C9D2D9;
  --side-active: #F27A4E;
  --f-head: "Archivo", "Helvetica Neue", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 6px;
  --shadow: 0 1px 2px rgba(14, 34, 51, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #F27A4E; --accent-text: #F27A4E; --on-accent: #0E2233;
    --bg: #0B1A27; --surface: #10263A; --surface-2: #0F2232; --ink: #E9E6DF; --muted: #9AA8B4;
    --line: #23405A; --line-soft: #1A3248; --ok: #5BC894; --ok-bg: #12382A; --bad: #F08A78; --bad-bg: #3A1D1A;
    --side-bg: #08141E; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #F27A4E; --accent-text: #F27A4E; --on-accent: #0E2233;
  --bg: #0B1A27; --surface: #10263A; --surface-2: #0F2232; --ink: #E9E6DF; --muted: #9AA8B4;
  --line: #23405A; --line-soft: #1A3248; --ok: #5BC894; --ok-bg: #12382A; --bad: #F08A78; --bad-bg: #3A1D1A;
  --side-bg: #08141E; --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); }
h1, h2, h3 { font-family: var(--f-head); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 .8em; }
.mono { font-family: var(--f-mono); font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex: none; vertical-align: -3px; }

/* ---------- İskelet ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: none; background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 22px; color: #F5F3EE; text-decoration: none; font: 700 1.15rem var(--f-head); }
.brand b { color: #F27A4E; font-weight: 800; }
.sidebar ul { list-style: none; margin: 0; padding: 0 10px; }
.sidebar li a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r);
  color: var(--side-ink); text-decoration: none; font-weight: 500;
}
.sidebar li a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar li a[aria-current="page"] { background: rgba(242, 122, 78, .14); color: #fff; box-shadow: inset 3px 0 0 var(--side-active); }
.sidebar-foot { margin-top: auto; padding: 16px 18px; font-size: .8rem; color: #8C9BA8; border-top: 1px solid rgba(255, 255, 255, .06); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 20;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-name { display: flex; flex-direction: column; align-items: flex-end; font-weight: 600; font-size: .9rem; line-height: 1.2; }
.user-name small { font-weight: 400; color: var(--muted); }
.company-switch select { min-height: 36px; font-weight: 600; }
.content { padding: 24px; max-width: 1280px; width: 100%; }
.nav-open, .nav-backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; }
  .nav-toggle:checked ~ .shell .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .4); }
  .nav-open { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
  .user-name { display: none; }
}

/* ---------- Bileşenler ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r); border: 1.5px solid transparent;
  font: 600 .92rem/1 var(--f-body); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(.94); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: var(--line); }
.btn-danger-ghost:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border: 0; border-radius: var(--r); background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.page-head { margin-bottom: 20px; }
.page-head p { margin: 0; }
.page-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.flash { padding: 10px 14px; border-radius: var(--r); margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error, .alert-error { background: var(--bad-bg); color: var(--bad); }
.alert { padding: 10px 14px; border-radius: var(--r); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line-soft); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.card-link { color: inherit; text-decoration: none; }
.card-link:hover { border-color: var(--accent); }
.card-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.card-value { font-size: 1.9rem; font-weight: 600; }
.empty { text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); }

/* ---------- Tablo ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 260px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input[type="search"] { padding-left: 36px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: var(--surface-2); }
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--accent-text); text-decoration: underline; }
.sort { color: inherit; text-decoration: none; }
.sort-asc::after { content: " ↑"; }
.sort-desc::after { content: " ↓"; }
.pagination { display: flex; gap: 4px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: var(--r); text-decoration: none; color: var(--ink); border: 1px solid var(--line-soft); background: var(--surface); }
.pagination [aria-current] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Form ---------- */
.form { max-width: 900px; }
.grid-2 { display: grid; gap: 0 16px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.field { margin: 0 0 14px; border: 0; padding: 0; }
.field label, .field legend { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; padding: 0; }
.req { color: var(--bad); }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r);
}
textarea { resize: vertical; min-height: 80px; }
select { width: auto; min-width: 160px; }
.field select { width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: .83rem; margin: 4px 0 0; }
.field-help { color: var(--muted); font-size: .8rem; margin: 4px 0 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500 !important; margin: 0 !important; }
.check input, .switch input { width: 17px; height: 17px; accent-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 6px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* ---------- Detay ---------- */
.detail-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .detail-grid { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.dl { margin: 0; display: grid; gap: 0; }
.dl div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.dl div:last-child { border-bottom: 0; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .dl div { grid-template-columns: 1fr; gap: 2px; } }
.contact-list { list-style: none; margin: 0 0 12px; padding: 0; }
.contact-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.add-inline summary { cursor: pointer; color: var(--accent-text); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; padding: 6px 0; }
.add-inline form { margin-top: 10px; }
.meta { margin-top: 8px; }

/* ---------- Giriş ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background-image: linear-gradient(rgba(14, 34, 51, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(14, 34, 51, .05) 1px, transparent 1px);
  background-size: 32px 32px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 32px 28px; box-shadow: 0 12px 32px -16px rgba(14, 34, 51, .3); }
.auth-brand { display: flex; align-items: center; gap: 10px; font: 700 1.3rem var(--f-head); margin-bottom: 24px; }
.auth-brand b { color: var(--accent-text); font-weight: 800; }
.auth-card h1 { font-size: 1.3rem; }
.auth-card .btn { margin-top: 6px; min-height: 44px; }
.auth-foot { margin: 20px 0 0; font-size: .88rem; color: var(--muted); text-align: center; }
.error-box { max-width: 520px; margin: 48px auto; text-align: center; }

/* ---------- Ek yerleşimler ---------- */
.grid-3 { display: grid; gap: 0 16px; }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.form-section { margin: 12px 0 12px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel > .table-wrap { border: 0; border-radius: 0; margin: 0 -20px -20px; border-top: 1px solid var(--line-soft); }
.num, .table .num { text-align: right; }
.cards-tight { margin-bottom: 16px; }
.card-warn { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.badge-out { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-text); border-color: transparent; }
.text-bad { color: var(--bad); font-weight: 600; }
[hidden] { display: none !important; }

/* ---------- Teklif ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a span { font-size: .78rem; background: var(--surface-2); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.badge-wait { background: #FFF1D6; color: #8A5A00; border-color: transparent; }
.badge-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge-muted { opacity: .7; text-decoration: line-through; }
.alert-warn { background: #FFF1D6; color: #8A5A00; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert p { margin: 0; }
.items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.item { border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px; margin: 0; background: var(--surface-2); }
.item.is-optional { opacity: .7; border-style: dashed; }
.item-top, .item-bottom { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.item-bottom { margin-top: 8px; }
.item-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 90px; }
.item-f > span { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.item-f input, .item-f select, .item-f textarea { min-height: 36px; padding: 6px 8px; width: 100%; min-width: 0; }
.item-f textarea { resize: vertical; min-height: 36px; }
.item-no { width: 22px; align-self: center; color: var(--muted); font-size: .85rem; }
.item-spec { flex: 0 0 80px; }
.item-product { flex: 1 1 200px; max-width: 280px; }
.item-desc { flex: 3 1 280px; }
.item-sm { flex: 0 1 70px; }
.item-total { flex: 1 1 110px; text-align: right; }
.item-total output { display: block; min-height: 36px; padding: 7px 0; font-weight: 600; }
.item-opt { flex: 0 0 auto; align-self: center; font-size: .85rem; }
.item-cost { margin-top: 6px; }
.item-cost summary { cursor: pointer; font-size: .82rem; color: var(--muted); font-weight: 600; }
input.warn { border-color: #D99A00; }
.totals { margin: 12px 0 0; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.totals-grand { font-weight: 700; font-size: 1.15rem; border-bottom: 2px solid var(--ink) !important; }
.totals-cost dd { color: var(--muted); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; z-index: 5; }
tfoot td { font-weight: 600; }
.tfoot-grand td { font-size: 1.05rem; border-top: 2px solid var(--ink); }
tr.is-optional td { color: var(--muted); }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; width: 280px; box-shadow: 0 12px 28px -12px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 10px; }
.menu-body form { display: flex; flex-direction: column; gap: 6px; }
.menu-body .btn { width: 100%; }

/* ---------- İş ---------- */
.progress { width: 100%; height: 6px; margin-top: 6px; appearance: none; border: 0; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.progress::-webkit-progress-bar { background: var(--line-soft); border-radius: 99px; }
.progress::-webkit-progress-value { background: var(--ok); border-radius: 99px; }
.progress::-moz-progress-bar { background: var(--ok); border-radius: 99px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-form input, .inline-form select { min-height: 34px; padding: 4px 8px; width: auto; flex: 1 1 140px; min-width: 0; }
.grid-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; }
tr.is-done td { color: var(--muted); }
.note-form { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.note-form textarea { flex: 1; }
.note { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.note p { margin: 0 0 2px; }
.pct-input { width: 80px !important; min-height: 34px; text-align: right; }
.btn.is-active { border-color: var(--accent); color: var(--accent-text); }
.add-inline-summary { cursor: pointer; color: var(--accent-text); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.user-name { color: inherit; text-decoration: none; } .user-name:hover small { color: var(--accent-text); }
.perm-group { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.perm-group .check { display: flex; margin: 4px 0 !important; }
.logo-preview { display: block; max-height: 60px; max-width: 220px; margin: 4px 0 8px; object-fit: contain; }
.audit-data { max-width: 380px; overflow-wrap: anywhere; font-family: var(--f-mono); font-size: .75rem; }
.contact-list a[aria-current] strong { color: var(--accent-text); }

/* ---------- Destek girişi bandı ve platform paneli ---------- */
.imp-banner { position: sticky; top: 0; z-index: 100; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 8px 16px; background: #8A1F0E; color: #fff; font-size: .9rem; }
.imp-banner .btn-secondary { background: #fff; color: #8A1F0E; border-color: #fff; }
.platform-top { display: flex; align-items: center; gap: 20px; padding: 0 24px; min-height: 56px; background: #08141E; color: #E9E6DF; }
.platform-top a { color: #C9D2D9; text-decoration: none; font-weight: 500; }
.platform-top a[aria-current], .platform-top a:hover { color: #F27A4E; }
.platform-top .brand { padding: 0; font-size: 1.05rem; }
.platform-top .brand small { color: #F27A4E; font: 600 .7rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; margin-left: 6px; }
.platform-top form { margin-left: auto; }
.platform-top .icon-btn { color: #C9D2D9; }
.platform-main { padding: 24px; max-width: 1280px; margin: 0 auto; }
.auth-wide { max-width: 520px; }
.auth-brand { color: var(--ink); text-decoration: none; }
.auth-card .check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400 !important; }
.auth-card .check input { margin-top: 3px; flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; border-radius: var(--r); margin-bottom: 16px; background: #FFF1D6; color: #6B4600; }
.notice form { margin: 0; }
.notice-bad { background: var(--bad-bg); color: var(--bad); }
.notice-info { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--ink); }
.plans-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 12px; }
.plan-card { gap: 6px; }
.plan-card .btn { margin-top: 10px; }
.plan-card-hl { border: 2px solid var(--accent); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .8rem; border: 1.5px solid var(--line); color: transparent; flex: none; }
.checklist li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.done a { color: var(--muted); text-decoration: line-through; }
.checklist { margin-top: 12px; }
