/* ==========================================================================
   Panel (pn-*)

   Tek cesur oge ust bant: eloksal koyu petrol zemin, ayin durumu buyuk bir
   cumle olarak yazilir, yaninda son 6 ay satis / maliyet. Gerisi sakin
   beyaz kartlar. Siparis asamalari gercek bir sira oldugu icin bagli
   istasyonlar ve tek tonlu (acik -> koyu) ray ile cizilir.

   Grafik renkleri (satis #1e9fd6, maliyet #cf7a2a) koyu bant zemininde
   ve karanlik modda renk korlugu dahil dogrulandi.
   ========================================================================== */

.pn {
    --pn-hero: #0d3445;
    --pn-hero-ink: #eef6f9;
    --pn-hero-ink-2: rgba(238, 246, 249, .72);
    --pn-hero-line: rgba(238, 246, 249, .16);
    --pn-sales: #1e9fd6;
    --pn-cost: #cf7a2a;

    /* Atolye hatti: tek ton, asama ilerledikce koyulasir */
    --pn-s1: #b9d3df;
    --pn-s2: #6aa6c0;
    --pn-s3: #0a6a8f;
    --pn-s4: #08516d;

    max-width: 1480px;
    margin: 0 auto;
    padding: 18px 22px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dark .pn {
    --pn-hero: #132733;
    --pn-s1: #2c4658;
    --pn-s2: #3d7591;
    --pn-s3: #5fb4d9;
    --pn-s4: #84c6e3;
}

.pn a { text-decoration: none; }
.pn :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* --------------------------------------------------------------------------
   Ust bant
   -------------------------------------------------------------------------- */

.pn-hero {
    position: relative;
    overflow: hidden;
    padding: 20px 26px 26px;
    border-radius: 18px;
    background: var(--pn-hero);
    color: var(--pn-hero-ink);
}

.dark .pn-hero { box-shadow: inset 0 0 0 1px var(--line); }
.pn-hero.is-compact { padding-bottom: 20px; }

.pn-hero-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.pn-hello {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--pn-hero-ink);
}

.pn-hello span { font-weight: 400; color: var(--pn-hero-ink-2); }

.pn-hero-actions { display: flex; gap: 8px; }

.pn-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border-radius: 9px;
    background: var(--pn-hero-ink);
    color: #08394b;
    font-size: 13.5px;
    font-weight: 650;
    white-space: nowrap;
}

.pn-btn .icon { font-size: 17px; }
.pn-btn:hover { background: #fff; }
.pn-btn.is-ghost { background: transparent; color: var(--pn-hero-ink); box-shadow: inset 0 0 0 1px var(--pn-hero-line); }
.pn-btn.is-ghost:hover { background: rgba(255, 255, 255, .08); }
.pn .pn-btn:focus-visible { outline-color: var(--pn-hero-ink); }

.pn-hero-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    align-items: end;
    gap: 28px 48px;
    margin-top: 26px;
}

.pn-headline {
    max-width: 24ch;
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(27px, 3.1vw, 42px);
    font-weight: 500;
    line-height: 1.12;
    letter-spacing: -.022em;
    font-variant-numeric: tabular-nums;
    color: #fff;
    text-wrap: balance;
}

.pn-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, max-content));
    gap: 14px 40px;
    margin: 26px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--pn-hero-line);
}

.pn-facts dt { font-size: 12.5px; color: var(--pn-hero-ink-2); }
.pn-facts dd { margin: 0; }
.pn-facts dd.num {
    margin-top: 3px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -.01em;
    color: #fff;
}
.pn-facts .is-up { color: #7fd6a6; }
.pn-facts .is-down { color: #f4a49b; }
.pn-fact-note { margin-top: 2px; font-size: 12px; color: var(--pn-hero-ink-2); }
.pn-fact-note a { color: var(--pn-hero-ink); text-decoration: underline; text-decoration-color: var(--pn-hero-line); text-underline-offset: 3px; }

/* Son 6 ay grafigi */
.pn-chart { margin: 0; }

.pn-chart figcaption {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    font-size: 12px;
    color: var(--pn-hero-ink-2);
}

.pn-legend { display: inline-flex; gap: 12px; }
.pn-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pn-legend i { width: 9px; height: 9px; border-radius: 2px; }
.pn-legend i.is-sales { background: var(--pn-sales); }
.pn-legend i.is-cost { background: var(--pn-cost); }

.pn-bars {
    display: flex;
    align-items: stretch;
    gap: 6px;
    height: 150px;
    margin-top: 12px;
    border-bottom: 1px solid var(--pn-hero-line);
}

.pn-col {
    position: relative;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 6px;
    cursor: default;
}

/* Yuzde yukseklikler icin kesin yukseklik: sutunu tamamen kaplar */
.pn-col-bars {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

.pn-col-bars span {
    width: 12px;
    min-height: 2px;
    border-radius: 4px 4px 0 0;
    transform-origin: bottom center;
    animation: pnGrow .55s cubic-bezier(.22, .8, .3, 1) both;
}

.pn-col-bars .is-sales { background: var(--pn-sales); }
.pn-col-bars .is-cost { background: var(--pn-cost); animation-delay: .06s; }

.pn-col-label {
    position: absolute;
    bottom: -22px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--pn-hero-ink-2);
}

.pn-col.is-now .pn-col-label { color: #fff; }
.pn-col:not(.is-now) .pn-col-bars span { opacity: .78; }

/* Uzerine gelince / odakta tutar */
.pn-col:hover,
.pn-col:focus-visible { background: rgba(255, 255, 255, .06); outline: none; }
.pn-col:hover .pn-col-bars span,
.pn-col:focus-visible .pn-col-bars span { opacity: 1; }

.pn-col:hover::after,
.pn-col:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    z-index: 3;
    transform: translateX(-50%);
    width: max-content;
    max-width: 220px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #fff;
    color: #13232b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    pointer-events: none;
}

.pn-col:first-child:hover::after,
.pn-col:first-child:focus-visible::after { left: 0; transform: none; }
.pn-col:last-child:hover::after,
.pn-col:last-child:focus-visible::after { left: auto; right: 0; transform: none; }

.pn-chart { padding-bottom: 22px; }

@keyframes pnGrow {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
    .pn-col-bars span { animation: none; }
}

/* --------------------------------------------------------------------------
   Kartlar ve satirlar
   -------------------------------------------------------------------------- */

.pn-row {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(300px, 1fr);
    gap: 16px;
    align-items: start;
}

.pn-row.is-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.pn-card {
    min-width: 0;
    padding: 18px 20px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

/* Kart basligi: uygulamanin diger kartlariyla ayni serit (db-card-head) —
   acik zemin, alt cizgi, yazinin solunda ince marka vurgusu */
.pn-card > .pn-card-head:first-child {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
    box-sizing: border-box;
    min-height: 50px;
    margin: -18px -20px 16px;
    padding: 12px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    border-radius: 13px 13px 0 0;
}

.pn-card-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
}

.pn-card-head h2::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 15px;
    margin-right: 8px;
    vertical-align: -2px;
    border-radius: 2px;
    background: var(--brand);
}

.pn-card-head a { font-size: 13px; font-weight: 500; color: var(--brand); }
.pn-card-head a:hover { text-decoration: underline; }

.pn-card-sub { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-3); }
.pn-card-head .pn-card-sub { margin: 0; }

.pn-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: var(--warn-soft);
    color: var(--warn-ink);
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}

.pn-muted { margin: 0; font-size: 13px; color: var(--ink-3); }

/* --------------------------------------------------------------------------
   Atolye hatti
   -------------------------------------------------------------------------- */

.pn-line {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 3px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pn-station { min-width: 0; padding-right: 12px; }
.pn-station:last-child { padding-right: 0; }

.pn-station-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 14px;
    color: inherit;
    position: relative;
}

/* Ray: istasyonlar arasi kesintisiz, tonu asamayla koyulasir */
.pn-station-head::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: -15px;
    height: 5px;
    border-radius: 3px;
    background: var(--pn-rail, var(--pn-s1));
}

.pn-station:last-child .pn-station-head::before { right: 0; }
.pn-station.is-draft { --pn-rail: var(--pn-s1); }
.pn-station.is-approved { --pn-rail: var(--pn-s2); }
.pn-station.is-production { --pn-rail: var(--pn-s3); }
.pn-station.is-completed { --pn-rail: var(--pn-s4); }

.pn-station-name { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.pn-station-count {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -.02em;
    color: var(--ink);
}

.pn-station.is-empty .pn-station-count { color: var(--ink-3); }
.pn-station-note { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pn-station-head:hover .pn-station-name { color: var(--brand); }

.pn-late {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--debt-soft);
    color: var(--debt-ink);
    font-size: 11.5px;
    font-weight: 650;
}

.pn-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.pn-chip {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--divider);
    color: inherit;
}

.pn-chip:hover { box-shadow: inset 0 0 0 1px var(--brand-line); }
.pn-chip-who { overflow: hidden; font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.pn-chip-meta { font-size: 11.5px; color: var(--ink-3); }
.pn-chip.is-late { box-shadow: inset 3px 0 0 var(--debt), inset 0 0 0 1px var(--divider); }
.pn-chip.is-late .pn-chip-meta { color: var(--debt-ink); font-weight: 600; }

.pn-chip-more { display: inline-block; padding: 2px 2px; font-size: 12px; font-weight: 600; color: var(--brand); }

/* --------------------------------------------------------------------------
   Sirada ne var
   -------------------------------------------------------------------------- */

.pn-todo-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.pn-todo-list li + li { border-top: 1px solid var(--divider); }

.pn-todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    color: inherit;
}

.pn-todo-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
}

.pn-todo-icon .icon { font-size: 17px; }
.pn-todo-item.is-danger .pn-todo-icon { background: var(--debt-soft); color: var(--debt); }
.pn-todo-item.is-warn .pn-todo-icon { background: var(--warn-soft); color: var(--warn-ink); }
.pn-todo-item.is-brand .pn-todo-icon { background: var(--brand-soft); color: var(--brand); }

.pn-todo-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pn-todo-text b { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.pn-todo-text span { font-size: 12.5px; color: var(--ink-3); }
.pn-todo-go { flex: 0 0 auto; font-size: 14px; color: var(--ink-3); }
.pn-todo-item:hover b { color: var(--brand); }

.pn-clear { display: flex; align-items: flex-start; gap: 12px; padding: 4px 0; color: var(--ink-2); font-size: 13px; }
.pn-clear .icon { font-size: 22px; color: var(--credit); }
.pn-clear p { margin: 0; }

/* --------------------------------------------------------------------------
   Bu hafta teslim
   -------------------------------------------------------------------------- */

.pn-week {
    display: grid;
    grid-auto-columns: minmax(148px, 1fr);
    grid-auto-flow: column;
    gap: 8px;
    /* Dar masaustunde gunler kart icinde yatay kayar; sayfa kaymaz */
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 2px;
}

.pn-day {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 120px;
    padding: 10px;
    border-radius: 10px;
    background: var(--surface-2);
}

.pn-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 0 2px 2px; }
.pn-day-head b { font-size: 13px; font-weight: 650; color: var(--ink); }
.pn-day-head span { font-size: 11.5px; color: var(--ink-3); }

.pn-day.is-today { background: var(--brand-soft); }
.pn-day.is-today .pn-day-head b { color: var(--brand); }
.pn-day.is-late { background: var(--debt-soft); }
.pn-day.is-late .pn-day-head b { color: var(--debt-ink); }
.pn-day.is-free { background: transparent; box-shadow: inset 0 0 0 1px var(--divider); }
.pn-day.is-free .pn-day-head b { color: var(--ink-3); font-weight: 600; }

.pn-job {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 9px;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: inset 3px 0 0 var(--pn-job, var(--debt)), 0 0 0 1px var(--divider);
    color: inherit;
}

.pn-job.is-approved { --pn-job: var(--pn-s2); }
.pn-job.is-production { --pn-job: var(--pn-s3); }
.pn-job.is-completed { --pn-job: var(--pn-s4); }
.pn-job:hover { box-shadow: inset 3px 0 0 var(--pn-job, var(--debt)), 0 0 0 1px var(--brand-line); }

.pn-job b { overflow: hidden; font-size: 12.5px; font-weight: 650; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }

.pn-job > span:not(.pn-job-foot) {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    color: var(--ink-2);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pn-job-foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); }
.pn-job-foot .num { color: var(--ink-2); font-weight: 600; }
.pn-job-foot .is-late { color: var(--debt-ink); font-weight: 650; }

/* --------------------------------------------------------------------------
   Urun gruplari
   -------------------------------------------------------------------------- */

.pn-groups { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.pn-group-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pn-group-name { min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.pn-group-name a { margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--brand); }
.pn-group-value { font-size: 13.5px; font-weight: 650; color: var(--ink); }

.pn-group-track { height: 8px; margin-top: 7px; border-radius: 4px; background: var(--divider); overflow: hidden; }
.pn-group-track span { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.pn-group.is-unknown .pn-group-track span { background: var(--ink-3); opacity: .55; }

.pn-group-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 5px; font-size: 12px; color: var(--ink-3); }
.pn-group-meta .is-down { color: var(--debt-ink); font-weight: 600; }

/* --------------------------------------------------------------------------
   Para durumu
   -------------------------------------------------------------------------- */

.pn-money {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.pn-money-main {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pn-money-main > span,
.pn-money-side > span { font-size: 12.5px; color: var(--ink-3); }

.pn-money-main b {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 500;
    letter-spacing: -.02em;
    color: var(--ink);
}

.pn-money-main small { font-size: 12.5px; color: var(--ink-2); }

.pn-money-side {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-2);
    color: inherit;
}

.pn-money-side b { font-family: var(--font-display); font-size: 19px; font-weight: 500; }
.pn-money-side.is-in b { color: var(--credit); }
.pn-money-side.is-out b { color: var(--debt); }
.pn-money-side:hover { box-shadow: inset 0 0 0 1px var(--brand-line); }

.pn-sub-title { margin: 18px 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }

.pn-due { margin: 0; padding: 0; list-style: none; }
.pn-due li + li { border-top: 1px solid var(--divider); }

.pn-due a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: baseline;
    gap: 12px;
    padding: 9px 0;
    color: inherit;
}

.pn-due-who { overflow: hidden; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.pn-due-when { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.pn-due-when.is-late { color: var(--debt-ink); font-weight: 600; }
.pn-due-when.is-today { color: var(--warn-ink); font-weight: 600; }
.pn-due b { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.pn-due a:hover .pn-due-who { color: var(--brand); }

/* --------------------------------------------------------------------------
   Son cari hareketleri
   -------------------------------------------------------------------------- */

.pn-recent { margin: 0; padding: 0; list-style: none; }
.pn-recent li + li { border-top: 1px solid var(--divider); }

.pn-recent a {
    display: grid;
    grid-template-columns: 28px minmax(0, 1.4fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: inherit;
}

.pn-recent-dir { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; }
.pn-recent-dir .icon { font-size: 14px; }
.pn-recent-dir.is-debit { background: var(--debt-soft); color: var(--debt); }
.pn-recent-dir.is-credit { background: var(--credit-soft); color: var(--credit); }
.pn-recent-who { overflow: hidden; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.pn-recent-doc { overflow: hidden; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; text-overflow: ellipsis; }
.pn-recent b { font-size: 13px; font-weight: 650; }
.pn-recent b.is-debit { color: var(--debt); }
.pn-recent b.is-credit { color: var(--credit); }

/* --------------------------------------------------------------------------
   Dar ekranlar
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
    .pn-row { grid-template-columns: minmax(0, 1fr); }
    .pn-hero-body { grid-template-columns: minmax(0, 1fr); align-items: start; }
    .pn-chart { max-width: 520px; }
}

@media (max-width: 899px) {
    .pn { padding: 12px 12px 32px; gap: 12px; }
    .pn-row.is-even { grid-template-columns: minmax(0, 1fr); }

    /* Hafta: bos gunler gizlenir, gunler alt alta */
    .pn-week { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
    .pn-day { min-height: 0; }
    .pn-day.is-free { display: none; }

    .pn-line { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 3px; }
    .pn-station:nth-child(2n) { padding-right: 0; }
    .pn-station:nth-child(2n) .pn-station-head::before { right: 0; }
}

@media (max-width: 640px) {
    .pn-hero { padding: 16px 16px 20px; border-radius: 14px; }
    .pn-hero-body { margin-top: 18px; gap: 22px; }
    .pn-hello span { display: block; margin-top: 2px; }
    .pn-btn span { display: none; }
    .pn-btn { width: 38px; padding: 0; justify-content: center; }
    .pn-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
    .pn-facts dd.num { font-size: 19px; }
    .pn-card { padding: 16px 14px 16px; border-radius: 12px; }
    .pn-card > .pn-card-head:first-child { margin: -16px -14px 14px; padding: 12px 14px; border-radius: 11px 11px 0 0; }
    .pn-station-count { font-size: 28px; }
    .pn-recent a { grid-template-columns: 28px minmax(0, 1fr) auto; }
    .pn-recent-doc { display: none; }
}

/* Kart basliklari yeni dilde (db-card-head ile ayni): serit ve dikey vurgu yok */
.pn-card > .pn-card-head:first-child {
    min-height: 0;
    margin: -18px -20px 14px;
    padding: 18px 20px 0;
    background: transparent;
    border-bottom: 0;
}
.pn-card-head h2 { font-size: 15px; }
.pn-card-head h2::before { display: none; }
@media (max-width: 899px) {
    .pn-card > .pn-card-head:first-child { margin: -16px -14px 12px; padding: 16px 14px 0; }
}
