/* Depo takip: koyu zeminde kawaii (Japon usulü sevimli) tema.
   Yuvarlak yazı tipi, pastel renkler, yumuşak köşeler, maskotlar. Sarı-siyah ikaz şeridi korunuyor. */
:root {
    --bg: #15141f;
    --surface: #1f1e2e;
    --raised: #2a2940;
    --line: #36344f;
    --text: #f6f1ff;
    --muted: #aaa4c8;

    --pink: #ff9ec7;          /* birincil renk */
    --pink-ink: #3a1830;
    --pink-shadow: #c96b95;
    --mint: #8fe3c8;
    --lav: #b9a7ff;
    --peach: #ffd27a;
    --danger: #ff8f8f;
    --hivis: #ffc629;

    --radius: 18px;
    --radius-sm: 14px;
    --font: "M PLUS Rounded 1c", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; color: var(--text); font: 500 16px/1.55 var(--font);
    background-color: var(--bg);
    /* hafif puantiye */
    background-image: radial-gradient(rgba(255, 255, 255, .045) 1.2px, transparent 1.3px);
    background-size: 22px 22px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.num, .num-l, .stat-value, input[type=number] { font-variant-numeric: tabular-nums; }
small { color: var(--muted); font-size: .8em; font-weight: 500; }

h1, h2 { font-weight: 800; line-height: 1.2; margin: 0 0 1rem; letter-spacing: .01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }

.title-row { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; min-width: 0; }
.title-row h1, .title-row h2 { margin: 0; }
.title-row .sub { margin: .1rem 0 0; }
.title-row > .icon { color: var(--pink); width: 26px; height: 26px; }
.panel-head .title-row { margin-bottom: 0; }

/* ---------- Üst bar ---------- */
.topbar {
    background: var(--surface); border-bottom: 1px solid var(--line);
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
    padding: calc(.5rem + env(safe-area-inset-top, 0px)) 1rem .5rem;
}
.topbar > * { min-width: 0; }
.brand { display: flex; align-items: center; text-decoration: none; color: var(--text); }
.logo { height: 26px; width: auto; display: block; }
.logo-text { font-weight: 800; font-size: 1.2rem; }

.mainnav { display: flex; justify-content: center; gap: .3rem; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .5rem 1rem; border-radius: 999px;
    color: var(--muted); text-decoration: none; font-weight: 700; white-space: nowrap;
}
.mainnav a:hover { color: var(--text); }
.mainnav a.active { background: var(--raised); color: var(--pink); }
.icon { flex: none; }

.userbar { display: flex; align-items: center; gap: .6rem; }
.who { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16ch; }
.logout { margin: 0; }
.linkbtn {
    font: inherit; font-weight: 700; color: var(--lav); background: none; border: 0; padding: .25rem 0;
    text-decoration: underline; text-decoration-style: wavy; text-underline-offset: 4px; cursor: pointer; white-space: nowrap;
}

.lang { display: flex; gap: 2px; }
.lang a {
    color: var(--muted); text-decoration: none; font-weight: 800; font-size: .88rem;
    padding: .3rem .55rem; border-radius: 999px;
}
.lang a.on { background: var(--raised); color: var(--text); }

.hazard { height: 5px; background: repeating-linear-gradient(-45deg, var(--hivis) 0 8px, #15141f 8px 16px); }

@media (max-width: 760px) {
    .topbar { grid-template-columns: auto 1fr; row-gap: .5rem; }
    .userbar { justify-self: end; }
    .who { display: none; }
    .mainnav { grid-column: 1 / -1; grid-row: 2; justify-content: stretch; }
    .mainnav a { flex: 1; justify-content: center; padding: .55rem .4rem; font-size: .92rem; }
}
@media (max-width: 440px) { .mainnav a .icon { display: none; } .mainnav a { font-size: .9rem; } }

/* ---------- İçerik, kartlar ---------- */
.content { max-width: 980px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }

.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
    padding: 1.3rem; margin-bottom: 1.25rem;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.panel-head h1, .panel-head h2 { margin: 0; }
.sub { margin: -.6rem 0 1rem; font-size: .92rem; }

.subtabs { display: flex; gap: .3rem; margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a {
    flex: none; padding: .5rem 1rem; color: var(--muted); text-decoration: none; font-weight: 700;
    border-radius: 999px; border: 1px solid transparent;
}
.subtabs a:hover { color: var(--text); }
.subtabs a.active { color: var(--pink-ink); background: var(--pink); }

/* ---------- Formlar ---------- */
.field { margin-bottom: 1rem; min-width: 0; }
label, legend { display: flex; align-items: center; gap: .4rem; font-weight: 700; margin-bottom: .4rem; }
label .icon, legend .icon { width: 17px; height: 17px; color: var(--pink); }

/* minmax(0, 1fr): sütun, içindeki kutunun (ör. iOS tarih kutusu) doğal genişliğiyle büyümesin */
.grid2, .grid-form { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
    .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-form { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; }
    .grid-form.three { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
}
.field.end { display: flex; align-items: flex-end; }
.field.end .btn { width: 100%; }

.input {
    display: block; width: 100%; min-width: 0; max-width: 100%;
    font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
    border: 2px solid var(--line); border-radius: var(--radius-sm);
    padding: .6rem .9rem; min-height: 50px;
}
.input:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 158, 199, .18); }
.input.qty { font-size: 2.4rem; font-weight: 800; text-align: center; padding: .35rem; color: var(--peach); }
.input.qty::-webkit-inner-spin-button, .input.qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input.qty { -moz-appearance: textfield; appearance: textfield; }
.input.slim { display: inline-block; min-height: 38px; padding: .25rem .6rem; width: auto; border-radius: 12px; }
select.input { cursor: pointer; }

/* iPhone/iPad (Safari): tarih kutusu kendi genişliğini dayatmasın, kartın dışına taşmasın */
@supports (-webkit-touch-callout: none) {
    input[type=date].input { -webkit-appearance: none; appearance: none; line-height: 1.4; }
    input[type=date].input::-webkit-date-and-time-value { text-align: left; margin: 0; }
}

.check { display: flex; align-items: center; gap: .55rem; margin: 0 0 1rem; font-weight: 700; }
.check input { width: 22px; height: 22px; accent-color: var(--pink); }

.choices { border: 0; padding: 0; margin: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem; min-width: 0; }
.choices legend { width: 100%; }
.chip { margin: 0; font-weight: 700; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
    display: inline-block; padding: .45rem 1rem; min-height: 42px; line-height: 1.6;
    border: 2px solid var(--line); border-radius: 999px; cursor: pointer; color: var(--muted); background: var(--bg);
}
.chip input:checked + span { background: var(--mint); border-color: var(--mint); color: #12322a; }
.chip input:focus-visible + span { outline: 3px solid var(--pink); outline-offset: 2px; }

/* ---------- Butonlar ---------- */
.btn {
    font: inherit; font-weight: 800; cursor: pointer; border-radius: 999px;
    border: 2px solid var(--line); background: var(--raised); color: var(--text);
    padding: .6rem 1.3rem; min-height: 48px;
    box-shadow: 0 3px 0 var(--line);
    transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn:focus-visible, .link:focus-visible, .linkbtn:focus-visible, a:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--pink); border-color: var(--pink); color: var(--pink-ink); box-shadow: 0 4px 0 var(--pink-shadow); }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--pink-shadow); transform: translateY(3px); }
.btn.block { width: 100%; font-size: 1.1rem; }
.icon-btn { padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.link {
    font: inherit; font-weight: 700; background: none; border: 0; padding: .25rem 0; cursor: pointer;
    color: var(--lav); text-decoration: underline; text-decoration-style: wavy; text-underline-offset: 4px; white-space: nowrap;
}
.link.danger { color: var(--danger); }

/* ---------- Mesajlar, rozetler, maskotlu durumlar ---------- */
.msg {
    display: flex; align-items: center; gap: .5rem;
    padding: .7rem 1rem; border-radius: var(--radius-sm); margin: 1rem 0 0; font-weight: 700;
}
.msg .icon { width: 18px; height: 18px; }
.msg.ok { color: var(--mint); background: rgba(143, 227, 200, .1); }
.msg.ok .icon { color: var(--pink); fill: var(--pink); }
.msg.error { color: var(--danger); background: rgba(255, 143, 143, .1); }
.hint { color: var(--muted); font-size: .92rem; margin: .45rem 0 0; }
.muted { color: var(--muted); }
.empty { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.25rem; color: var(--muted); margin: 0; }

.empty-mascot {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem;
    padding: 1.4rem 1rem; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}
.empty-mascot p { margin: 0; max-width: 34ch; }

.celebrate {
    display: flex; align-items: center; gap: .6rem; margin-top: 1rem;
    padding: .6rem 1rem; border-radius: var(--radius-sm);
    background: rgba(255, 210, 122, .12); color: var(--peach);
}
.celebrate .kawaii { animation: hop .6s ease 2; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px) rotate(-6deg); } }

.badge {
    display: inline-block; font-size: .85rem; font-weight: 700; line-height: 1.5;
    padding: .1rem .7rem; border-radius: 999px; background: var(--raised); color: var(--muted); white-space: nowrap;
}
.badge.warn { background: rgba(255, 210, 122, .15); color: var(--peach); }
.badge.bad { background: rgba(255, 143, 143, .14); color: var(--danger); }
.badge.ok { background: rgba(143, 227, 200, .13); color: var(--mint); }
.badge.info { background: rgba(185, 167, 255, .16); color: var(--lav); }

.kawaii { flex: none; display: block; }

/* ---------- Sonraki teslimat ---------- */
.delivery {
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .3rem .8rem;
    background: var(--bg); border: 2px solid var(--line); border-radius: var(--radius);
    padding: .8rem 1rem .8rem 1.4rem; margin-bottom: 1.25rem; overflow: hidden;
}
.delivery::before {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 8px;
    background: repeating-linear-gradient(-45deg, var(--hivis) 0 7px, #15141f 7px 14px);
}
.delivery .body { display: flex; flex-direction: column; min-width: 0; }
.delivery .label { color: var(--muted); font-size: .88rem; font-weight: 700; }
.delivery .when { font-weight: 800; font-size: 1.05rem; }
.delivery .note { color: var(--muted); font-size: .9rem; }
.delivery.none::before { background: var(--line); }
.delivery.none .kawaii { opacity: .45; filter: grayscale(1); }
.delivery.none .when { font-weight: 500; color: var(--muted); font-size: 1rem; }
@media (max-width: 480px) {
    .delivery { grid-template-columns: auto minmax(0, 1fr); }
    .delivery .badge { grid-column: 2; justify-self: start; }
}

/* ---------- İstatistik kutucukları ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { background: var(--raised); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; min-width: 0; }
.stat-label { color: var(--muted); font-size: .88rem; font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.stat-label::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--mint); }
.stat:nth-child(3) .stat-label::before { background: var(--peach); }
.stat.bad .stat-label::before { background: var(--danger); }
.stat-value { font-weight: 800; font-size: 1.5rem; line-height: 1.25; }
.stat-value small { font-size: .85rem; }
@media (max-width: 520px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat:nth-child(3) { grid-column: 1 / -1; }
    .stat-value { font-size: 1.3rem; }
}

/* ---------- Tablolar ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .75rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { color: var(--muted); font-weight: 700; font-size: .9rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table td.num strong { font-size: 1.1rem; color: var(--peach); }
.table .act { text-align: right; width: 1%; white-space: nowrap; }
.table tfoot tr:first-child th { border-top: 2px dashed var(--lav); }
.table tfoot th { border-bottom: 0; font-weight: 800; }
.table tfoot th:first-child { color: var(--muted); }
.table tr.off td { color: var(--muted); }
.table tr.current td { background: var(--raised); }
.table tr.current td:first-child { border-radius: 12px 0 0 12px; }
.table tr.current td:last-child { border-radius: 0 12px 12px 0; }
.pin-reset { display: flex; align-items: center; gap: .6rem; }
.pin-reset .input { width: 8ch; }
.nowrap { white-space: nowrap; }
.show-sm { display: none; }
@media (max-width: 520px) {
    .table .by, .table .hide-sm { display: none; }
    .show-sm { display: block; font-size: .9rem; }
    .nowrap { white-space: normal; }
    .table th, .table td { padding: .65rem .5rem; }
}

/* ---------- Rapor tarih gezgini ---------- */
.date-nav { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: .5rem; }
.date-nav .btn { padding: 0; min-height: 50px; }

/* ---------- App yükleme ---------- */
[hidden] { display: none !important; }
.install { position: relative; }
.install-btn { min-height: 36px; width: 36px; padding: 0; color: var(--pink); box-shadow: none; }
.install-wide { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; margin-top: 1rem; }
.install-hint {
    margin: .6rem 0 0; padding: .6rem .9rem; font-size: .92rem; color: var(--text);
    background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.userbar .install-hint { position: absolute; right: 0; top: calc(100% + .5rem); width: 240px; z-index: 20; }

/* ---------- Giriş ---------- */
.login { max-width: 420px; margin: 0 auto; padding: calc(2.5rem + env(safe-area-inset-top, 0px)) 0 2rem; }
.login-logo { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.login-logo .logo { height: 52px; }
.login-logo .logo-text { font-size: 2rem; }
.login .hazard { border-radius: 24px 24px 0 0; }
.login .panel { border-top: 0; border-radius: 0 0 24px 24px; }
.login .panel-head { margin-bottom: 1.25rem; flex-wrap: wrap; }
.login .input { font-size: 1.2rem; letter-spacing: .08em; }
.login form .btn.block { margin-top: .5rem; }

/* ---------- Yazdırma ---------- */
@media print {
    :root { --text: #000; --muted: #444; --line: #bbb; --surface: #fff; --bg: #fff; --raised: #f2f2f2; --peach: #000; color-scheme: light; }
    body { background: #fff; }
    .topbar, .hazard, .no-print, #blazor-error-ui, .kawaii { display: none !important; }
    .panel { border: 0; padding: 0; box-shadow: none; }
    .badge.bad { color: #b00; background: none; padding: 0; }
}

@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

#blazor-error-ui {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    background: var(--peach); color: #15141f; font-weight: 800;
    padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom, 0px));
}
#blazor-error-ui .reload { margin-left: 1rem; color: inherit; }
