:root {
  --bg: #f3f5f8; --card: #fff; --text: #1d2530; --muted: #6b7684; --line: #e2e6ec;
  --primary: #0b5fa5; --primary-d: #084a82; --ok: #1f9d55; --warn: #d98c00; --danger: #c93a3a;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .6rem; }
h2 { font-size: 1.05rem; margin: 0 0 .7rem; color: #2c3540; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
.inline { display: inline; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* Üst bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1.2rem; padding: .55rem 1rem; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand span { color: var(--primary); }
.topbar nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.topbar nav a { padding: .35rem .7rem; border-radius: 6px; color: #384453; }
.topbar nav a.on, .topbar nav a:hover { background: #eaf1f9; color: var(--primary); text-decoration: none; }
.userbox { margin-left: auto; display: flex; gap: .8rem; align-items: center; }

.container { max-width: 1180px; margin: 0 auto; padding: 1rem; }
body.center .container { max-width: 420px; margin-top: 8vh; }
body.mobile .container { max-width: 640px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.card.narrow { max-width: 420px; }
.card.login h1 { text-align: center; margin-bottom: 1rem; }
.card.login h1 span { color: var(--primary); }
.card.scroll, .scroll { overflow-x: auto; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.pagehead .sub { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 1rem; }
@media (max-width: 800px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* Flash */
.flash { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; background: #e6f4ea; color: #1b5e20; border: 1px solid #bfe3c8; }
.flash.error { background: #fdecec; color: #8a1c1c; border-color: #f3c4c4; }

/* İstatistik kutuları */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; color: var(--text); display: flex; flex-direction: column; }
.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat b { font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.ok b { color: var(--ok); } .stat.warn b { color: var(--warn); } .stat.danger b { color: var(--danger); }

/* Tablolar */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 600; font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .5rem .5rem; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.hover tr:hover td { background: #f7f9fc; cursor: pointer; }
.tbl tr.inactive td { opacity: .5; }
.tbl .note { color: #444; font-size: .9em; white-space: pre-wrap; }

/* Rozetler */
.badge { display: inline-block; font-size: .75rem; padding: .12rem .5rem; border-radius: 999px; background: #eef1f5; color: #3b4652; vertical-align: middle; white-space: nowrap; }
.st-aktif { background: #e3f4e8; color: #1b6b3a; }
.st-arizali { background: #fdecec; color: #9b2222; }
.st-serviste { background: #fff3dc; color: #8a5a00; }
.st-hurda { background: #e9e9e9; color: #555; }
.mv-ariza { background: #fdecec; color: #9b2222; }
.mv-konum { background: #e3ecf9; color: #1e4f8a; }
.mv-zimmet { background: #efe6f9; color: #5b2f8a; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c6ccd4; vertical-align: middle; margin-right: 2px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); }

/* Form */
label { display: block; font-size: .85rem; color: #3b4652; margin-bottom: .6rem; }
label.inline { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }
input, select, textarea { width: 100%; padding: .5rem .6rem; border: 1px solid #c9d0d9; border-radius: 7px; font: inherit; background: #fff; margin-top: .2rem; color: var(--text); }
input[type=checkbox] { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd6f0; border-color: var(--primary); }
textarea { resize: vertical; }
.inline-input { margin: 0; padding: .3rem .45rem; }
.inline-input.short { width: 9rem; display: inline-block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid fieldset { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem .2rem; margin: 0 0 .9rem; }
.form-grid legend { font-size: .8rem; color: var(--muted); padding: 0 .3rem; text-transform: uppercase; letter-spacing: .03em; }
.span2 { grid-column: 1 / -1; }
.actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) { .form-grid, .form-grid fieldset { grid-template-columns: 1fr; } }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .7rem .9rem; }
.filters input, .filters select { width: auto; margin: 0; min-width: 9rem; flex: 1 1 9rem; }
.filters input[name=q] { flex: 2 1 14rem; }

/* Butonlar */
.btn { display: inline-block; padding: .5rem .9rem; border: 1px solid #c9d0d9; border-radius: 7px; background: #fff; color: var(--text); font: inherit; cursor: pointer; line-height: 1.2; }
.btn:hover { background: #f4f6f9; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.danger { background: #fff; color: var(--danger); border-color: #e9b8b8; }
.btn.wide { width: 100%; text-align: center; margin-top: .4rem; }
.btn.link, button.link { border: 0; background: none; color: var(--primary); padding: .2rem .3rem; cursor: pointer; font: inherit; }
button.link.danger { color: var(--danger); }

/* Tanım listeleri */
dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; margin: 0; }
dt { color: var(--muted); font-size: .85rem; }
dd { margin: 0; }
dl.compact { margin-top: .6rem; }
.note { white-space: pre-wrap; background: #f7f9fc; padding: .5rem .7rem; border-radius: 7px; margin: .6rem 0 0; }

/* QR kartı */
.qrcard { text-align: center; }
.qrwrap { position: relative; display: inline-block; }
.qrlogo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #fff; padding: 2px; border: 0 !important; border-radius: 3px !important; }
.qrcard img { image-rendering: pixelated; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }

/* Hızlı işlemler */
.quick { display: flex; flex-wrap: wrap; gap: .5rem; }
.qa { flex: 1 1 140px; }
.qa summary { list-style: none; text-align: center; width: 100%; user-select: none; }
.qa summary::-webkit-details-marker { display: none; }
.qa[open] summary { background: var(--primary); color: #fff; border-color: var(--primary); }
.qa form { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; padding: .7rem; background: #fafbfd; }
.qa[open] { flex-basis: 100%; }
.qa button { margin-top: .2rem; }

/* Belgeler */
.docs { list-style: none; padding: 0; margin: 0; }
.docs li { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .4rem 0; border-bottom: 1px solid #eef1f5; }
.docs li:last-child { border-bottom: 0; }
.docs li form { margin-left: auto; }

/* Mobil (QR) kart */
.mcard .mcode { font-size: 1.6rem; font-weight: 700; }
.mcard .mname { font-size: 1.1rem; }
.pubcode { font-size: 2rem; font-weight: 700; text-align: center; margin-top: .5rem; }
.pubname { text-align: center; font-size: 1.1rem; margin-bottom: .8rem; }
body.mobile .btn, body.mobile input, body.mobile select { min-height: 44px; }

/* Dar ekran: üst bar sadeleşir, hareket tablosu alt alta dizilir */
@media (max-width: 640px) {
  .topbar { padding: .5rem .8rem; gap: .5rem; }
  .topbar nav { display: none; }
  body.mobile .topbar nav { display: none; }
  .userbox { margin-left: auto; }
  .timeline, .timeline tr, .timeline td { display: block; }
  .timeline tr { padding: .5rem 0; border-bottom: 1px solid #eef1f5; }
  .timeline td { padding: .1rem 0; border: 0; }
  .timeline td.nowrap { display: inline-block; margin-right: .5rem; }
  .timeline td:nth-child(2) { display: inline-block; }
}
