/* =========================================================================
   Volkan Lazer Fatura Takip — design system (saf CSS)
   ========================================================================= */
:root {
    --brand:        #1f3a93;
    --brand-dark:   #16285f;
    --brand-light:  #2e4fb8;
    --accent:       #e8541e;   /* "lazer" turuncu */
    --accent-dark:  #c2440f;

    --bg:           #f4f6fb;
    --surface:      #ffffff;
    --surface-2:    #f8fafc;
    --border:       #e2e8f0;
    --border-strong:#cbd5e1;

    --text:         #1e293b;
    --text-soft:    #475569;
    --text-muted:   #94a3b8;

    --success:      #15803d;
    --success-bg:   #dcfce7;
    --warning:      #b45309;
    --warning-bg:   #fef3c7;
    --danger:       #b91c1c;
    --danger-bg:    #fee2e2;
    --info:         #1d4ed8;
    --info-bg:      #dbeafe;

    --radius:       10px;
    --radius-sm:    6px;
    --shadow-sm:    0 1px 2px rgba(15, 23, 42, .06);
    --shadow:       0 4px 14px rgba(15, 23, 42, .08);
    --shadow-lg:    0 12px 32px rgba(15, 23, 42, .14);

    --sidebar-w:    250px;
    --header-h:     62px;
    --font:         "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; color: var(--text); }

/* ----------------------------------------------------------------- layout */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 100vh;
}

.sidebar {
    background: var(--brand-dark);
    color: #cdd7f5;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: #fff;
}
.sidebar__brand .logo {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: grid; place-items: center;
    font-weight: 700; color: #fff; font-size: 1rem;
    box-shadow: 0 2px 8px rgba(232,84,30,.5);
}
.sidebar__brand strong { font-size: .98rem; line-height: 1.1; }
.sidebar__brand small { display: block; font-size: .72rem; color: #9fb0e6; font-weight: 400; }

.sidebar__nav { padding: .75rem .6rem; flex: 1; }
.sidebar__section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #7f93d6; padding: 1rem .7rem .35rem; }
.sidebar__link {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: #cdd7f5;
    font-size: .92rem;
    margin-bottom: 2px;
}
.sidebar__link:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.sidebar__link.is-active { background: var(--brand-light); color: #fff; font-weight: 500; }
.sidebar__link .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar__link .badge { margin-inline-start: auto; }

.sidebar__foot { padding: .85rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; color: #9fb0e6; }

.main { display: flex; flex-direction: column; overflow: hidden; }

.topbar {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 1.5rem; gap: 1rem;
    box-shadow: var(--shadow-sm);
}
.topbar__title { font-size: 1.05rem; font-weight: 600; }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--text-soft); }
.topbar__user .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: grid; place-items: center; font-weight: 600; font-size: .85rem;
}

.content { padding: 1.5rem; overflow-y: auto; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.4rem; margin: 0; }
.page-head .sub { color: var(--text-muted); font-size: .85rem; margin-top: .15rem; }

/* --------------------------------------------------------------- cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}
.card__head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card__head h2, .card__head h3 { margin: 0; font-size: 1rem; }
.card__body { padding: 1.25rem; }
.card__body--tight { padding: 0; }

/* --------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.1rem 1.25rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat__label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat__value { font-size: 1.7rem; font-weight: 700; margin-top: .35rem; color: var(--text); }
.stat__hint { font-size: .8rem; color: var(--text-soft); margin-top: .2rem; }
.stat::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.stat--open::after    { background: var(--info); }
.stat--overdue::after { background: var(--danger); }
.stat--paid::after    { background: var(--success); }
.stat--amount::after  { background: var(--accent); }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .7rem .9rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data thead th { background: var(--surface-2); color: var(--text-soft); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-empty { padding: 2.5rem 1rem; text-align: center; color: var(--text-muted); }
.table-empty .ico { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .5; }

/* --------------------------------------------------------------- badges */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .55rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600; line-height: 1.4;
    white-space: nowrap;
}
.badge--open    { background: var(--info-bg);    color: var(--info); }
.badge--partial { background: var(--warning-bg); color: var(--warning); }
.badge--paid    { background: var(--success-bg); color: var(--success); }
.badge--overdue { background: var(--danger-bg);  color: var(--danger); }
.badge--muted   { background: #f1f5f9;           color: var(--text-soft); }
.badge--brand   { background: #e0e7ff;           color: var(--brand); }
.badge--accent  { background: #ffe7da;           color: var(--accent-dark); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* --------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .55rem 1rem; border-radius: var(--radius-sm);
    font-size: .9rem; font-weight: 500; font-family: inherit;
    border: 1px solid transparent; cursor: pointer; transition: .15s ease;
    text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-light); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-dark); }
.btn--success { background: var(--success); color: #fff; }
.btn--success:hover { filter: brightness(1.08); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(1.08); }
.btn--ghost { background: var(--surface); color: var(--text-soft); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { padding: .35rem .7rem; font-size: .82rem; }
.btn--block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; }

.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* --------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: .85rem; font-weight: 500; color: var(--text-soft); }
.field label .req { color: var(--danger); }
.input, .select, .textarea {
    width: 100%; padding: .55rem .7rem;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-family: inherit; font-size: .92rem; color: var(--text); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(46,79,184,.15);
}
.textarea { resize: vertical; min-height: 90px; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.field__error { color: var(--danger); font-size: .8rem; }
.field__hint { color: var(--text-muted); font-size: .8rem; }
.input-prefix { position: relative; display: flex; align-items: center; }
.input-prefix > span { position: absolute; inset-inline-start: .7rem; color: var(--text-muted); font-size: .9rem; pointer-events: none; }
.input-prefix .input { padding-inline-start: 1.9rem; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

.checkbox { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text-soft); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }

/* --------------------------------------------------------------- filters */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.filters .field { gap: .25rem; }
.chip-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .35rem .75rem; border-radius: 999px; font-size: .82rem;
    border: 1px solid var(--border-strong); color: var(--text-soft); background: #fff;
}
.chip:hover { background: var(--surface-2); text-decoration: none; }
.chip.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip .count { font-weight: 600; }

/* --------------------------------------------------------------- alerts */
.alert {
    display: flex; align-items: flex-start; gap: .65rem;
    padding: .8rem 1rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent;
}
.alert .ico { font-size: 1.05rem; line-height: 1.4; }
.alert--success { background: var(--success-bg); color: #14532d; border-color: #bbf7d0; }
.alert--error   { background: var(--danger-bg);  color: #7f1d1d; border-color: #fecaca; }
.alert--warning { background: var(--warning-bg); color: #78350f; border-color: #fde68a; }
.alert--info    { background: var(--info-bg);    color: #1e3a8a; border-color: #bfdbfe; }
.alert ul { margin: .25rem 0 0; padding-inline-start: 1.1rem; }

/* --------------------------------------------------------------- pagination */
.pagination { display: flex; gap: .25rem; list-style: none; padding: 1rem 1.25rem; margin: 0; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 34px; height: 34px; padding: 0 .5rem;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: .85rem; color: var(--text-soft); background: #fff;
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .active span { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled span { color: var(--text-muted); opacity: .5; }

/* --------------------------------------------------------------- misc */
.muted { color: var(--text-muted); }
.text-end { text-align: end; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.gap-sm { gap: .5rem; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; border: 0; }

.detail-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }
.amount-box { text-align: center; padding: .4rem 0; }
.amount-box .label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.amount-box .value { font-size: 1.9rem; font-weight: 700; }
.amount-rows { display: grid; gap: .5rem; }
.amount-rows .row { display: flex; justify-content: space-between; padding: .5rem .25rem; border-bottom: 1px dashed var(--border); font-variant-numeric: tabular-nums; }
.amount-rows .row:last-child { border-bottom: 0; }
.amount-rows .row.total { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--border-strong); border-bottom: 0; padding-top: .7rem; }

.def-list { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: .55rem 1rem; font-size: .9rem; }
.def-list dt { color: var(--text-muted); }
.def-list dd { margin: 0; font-weight: 500; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.5rem; border-inline-start: 2px solid var(--border); }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline .when { font-size: .78rem; color: var(--text-muted); }

/* --------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(135deg, var(--brand-dark), var(--brand) 60%, var(--brand-light)); }
.auth__card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 2rem; }
.auth__brand { text-align: center; margin-bottom: 1.5rem; }
.auth__brand .logo { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto .8rem; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); display: grid; place-items: center; font-size: 1.4rem; font-weight: 700; color: #fff; box-shadow: 0 6px 18px rgba(232,84,30,.45); }
.auth__brand h1 { font-size: 1.2rem; margin: 0; }
.auth__brand p { color: var(--text-muted); font-size: .85rem; margin: .25rem 0 0; }

/* --------------------------------------------------------------- responsive */
.sidebar__toggle { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--text-soft); cursor: pointer; }
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar__toggle { display: block; }
    .backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; }
    [dir="rtl"] .sidebar { transform: translateX(105%); }
}
