:root {
  --brand: #123a40; --brand-2: #24505a; --accent: #1f7a4c; --danger: #a33a2e; --warn: #9a6b00;
  --bg: #f3f5f8; --panel: #ffffff; --ink: #172a39; --muted: #5d6b78; --line: #dce3e9; --sel: #dff0e8;
  --radius: 8px; font-size: 15px;
}
[data-theme="dark"] {
  --bg: #14242d; --panel: #213640; --ink: #eef4f5; --muted: #a9b8bf; --line: #3d5059; --sel: #2c4e45;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: inherit; }
h1 { font-size: 1.7rem; margin: 0 0 .25rem; font-weight: 600; }
h2 { font-size: 1.2rem; margin: 1.2rem 0 .6rem; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .pre { white-space: pre-wrap; }
.badge { display: inline-block; background: var(--line); border-radius: 99px; padding: 2px 10px; }

/* Düzen */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex: none; background: var(--brand); color: #e9f1f2; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; text-align: center; text-decoration: none; margin-bottom: 14px; }
.brand img { width: 100%; background: #fff; border-radius: var(--radius); padding: 6px; }
.brand span { display: block; font-size: .8rem; color: #c4d7d9; margin-top: 6px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar a, .sidebar .link, .nav-more summary { display: block; color: #e9f1f2; text-decoration: none; padding: 8px 10px; border-radius: 6px; font-size: .95rem; background: none; border: 0; text-align: left; width: 100%; cursor: pointer; font-family: inherit; }
.sidebar a.nav-big { font-size: 1.1rem; font-weight: 600; }
.sidebar a:hover, .sidebar .link:hover, .nav-more summary:hover { background: var(--brand-2); }
.sidebar a.active { background: #2f6b63; }
.nav-more a { padding-left: 22px; font-size: .9rem; }
.sidebar-bottom { border-top: 1px solid #2e5961; padding-top: 10px; margin-top: 10px; }
.sidebar-bottom form { margin: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 20px 26px 60px; max-width: 1700px; width: 100%; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

/* Bileşenler */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.toolbar.actions { margin-top: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; text-decoration: none; min-height: 38px; }
.btn:hover:not(:disabled) { border-color: var(--brand-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-secondary { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-small { padding: 4px 10px; min-height: 30px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: inherit; line-height: 1; padding: 4px 8px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-height: 38px; max-width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #5aa58a; outline-offset: 0; }
input[readonly], select:disabled, input:disabled { opacity: .75; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.search { width: 300px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.form input, .form select, .form textarea { width: 100%; font-weight: 400; }
.form label.check input { width: auto; min-height: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.narrow { max-width: 480px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { margin-top: 0; }
.alert { padding: 10px 12px; border-radius: 6px; background: var(--sel); margin: 8px 0; }
.alert-error { background: #f7dcd8; color: #6d1d14; font-weight: 600; }
[data-theme="dark"] .alert-error { background: #5a2a25; color: #ffe1dc; }
.debt { font-size: 1.25rem; font-weight: 600; margin: 8px 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
.card:hover { border-color: var(--brand-2); }
.card-title { color: var(--muted); }
.card-value { font-size: 1.45rem; font-weight: 600; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: 12px 0 8px; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; cursor: pointer; font: inherit; color: var(--muted); }
.tab.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }

/* Tablo */
.grid-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.grid { border-collapse: collapse; width: 100%; font-size: .92rem; }
.grid th { position: sticky; top: 0; background: var(--brand); color: #fff; text-align: left; padding: 8px 10px; white-space: nowrap; cursor: pointer; font-weight: 600; z-index: 1; }
.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 90px; max-width: 360px; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: rgba(31, 122, 76, .07); }
.grid tbody tr.selected { background: var(--sel); }
.grid .num { text-align: right; white-space: nowrap; }
.grid td.bad { color: var(--danger); font-weight: 600; } .grid td.warn { color: var(--warn); font-weight: 600; } .grid td.muted { color: var(--muted); }
.empty { padding: 20px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.status { font-size: .85rem; color: var(--muted); margin-top: 6px; }
table.perm { border-collapse: collapse; width: 100%; }
table.perm td, table.perm th { border-bottom: 1px solid var(--line); padding: 6px; text-align: center; }
table.perm td:first-child, table.perm th:first-child { text-align: left; }

/* Sipariş */
.order-layout { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 16px; align-items: start; }
.picker { display: flex; flex-direction: column; gap: 6px; }
.picker-list { width: 100%; }
.payments { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.payment-row { display: grid; grid-template-columns: 150px 120px 1fr 1fr auto; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.payment-row label { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; gap: 3px; }
.payment-row .wide { grid-column: 1 / -1; }
.payment-row.cancelled { opacity: .6; text-decoration: line-through; }
.payment-row input, .payment-row select { width: 100%; }
.totals { font-size: 1.15rem; font-weight: 600; margin-top: 14px; line-height: 1.6; }
.footer-bar { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0; display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.footer-bar .muted { margin-right: auto; }

/* Takvim */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar.day { grid-template-columns: 1fr; }
.cal-head { font-weight: 600; text-align: center; padding: 4px; color: var(--muted); }
.cal-day { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; min-height: 120px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-day.empty { background: transparent; border: 0; }
.cal-day.today { border: 2px solid var(--accent); }
.cal-date { font-weight: 600; font-size: .85rem; }
.cal-item { border-left: 4px solid #3a7bd5; background: rgba(58, 123, 213, .09); padding: 4px 6px; border-radius: 4px; font-size: .82rem; display: flex; flex-direction: column; cursor: pointer; }
.cal-item.mount { border-left-color: #c77c0e; background: rgba(199, 124, 14, .1); }
.cal-item.done { opacity: .6; } .cal-item.cancelled { opacity: .45; text-decoration: line-through; }

/* Pencere */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 20, 25, .55); display: flex; align-items: flex-start; justify-content: center; z-index: 50; overflow-y: auto; padding: 40px 12px; }
.modal { background: var(--panel); border-radius: 10px; width: 100%; max-width: 560px; padding: 18px 20px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal-wide { max-width: 860px; } .modal-small { max-width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2, .modal h2 { margin: 0 0 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #1f5f43; color: #fff; padding: 12px 14px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.25); cursor: pointer; white-space: pre-wrap; }
.toast-error { background: var(--danger); }

/* Giriş */
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-card label { font-weight: 600; font-size: .92rem; }
.login-card .check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.login-logo { width: 100%; max-width: 260px; align-self: center; }

#blazor-error-ui { background: #ffe9a8; color: #222; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* Telefon ve dar ekran */
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .menu-open .sidebar { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .topbar { display: flex; align-items: center; gap: 10px; background: var(--brand); color: #fff; padding: 8px 12px; position: sticky; top: 0; z-index: 30; }
  .topbar-title { font-weight: 600; letter-spacing: .5px; }
  .content { padding: 14px 12px 60px; }
  .order-layout, .row2 { grid-template-columns: 1fr; }
  .payment-row { grid-template-columns: 1fr 1fr; }
  .search { width: 100%; }
  .grid-wrap { max-height: none; border: 0; background: transparent; }
  table.grid thead { display: none; }
  table.grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid tr { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 6px 4px; }
  .grid td { border: 0; padding: 3px 10px; max-width: none; display: flex; gap: 10px; justify-content: space-between; text-align: right; }
  .grid td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; flex: none; max-width: 45%; }
  .grid td:empty { display: none; }
  .grid .num { text-align: right; }
  .calendar { grid-template-columns: 1fr; }
  .cal-head, .cal-day.empty { display: none; }
  .cal-day { min-height: 0; }
}
h1:focus { outline: none; }
