/* Satın Alma departmanı */

/* Ana sayfa: üç portal kartı ve kilitli kart */
.portal-options.portal-options-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .portal-options.portal-options-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .portal-options.portal-options-3 { grid-template-columns: 1fr; } }
.portal-choice.po-choice { background: radial-gradient(90% 120% at 100% 0%, rgba(34, 197, 94, 0.14), transparent 60%), var(--bg-surface) !important; }
.portal-choice.po-choice .portal-choice-icon { color: #22c55e; background: rgba(34, 197, 94, 0.13); }
.portal-choice.po-choice .portal-enter { color: #22c55e; }
.portal-choice.po-choice:not(.is-locked):hover { border-color: #22c55e !important; box-shadow: 0 24px 48px -24px #22c55e; }
.portal-choice.is-locked { cursor: not-allowed !important; filter: grayscale(0.85); opacity: 0.55; transform: none !important; box-shadow: none !important; }
.portal-choice.is-locked:hover { border-color: var(--border-color-hover, var(--border-color)) !important; }
.portal-lock { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; padding: 4px 10px; border-radius: 999px; background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border-color); }
.portal-locked-text { color: var(--text-muted) !important; display: inline-flex; align-items: center; gap: 6px; }

/* Ortak */
#purchasingSection .portal-welcome a { color: inherit; text-decoration: none; }
#purchasingSection .portal-welcome a:hover { color: var(--primary); }
.po-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.po-head-actions select, .po-toolbar select { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 0.88rem; }
.po-head-actions select, .po-toolbar select { width: auto !important; flex: 0 0 auto; min-width: 120px; }
.po-new-btn { padding: 10px 18px !important; font-weight: 700 !important; }
.po-stats { margin-bottom: 20px; }
.po-stats .home-stat strong { font-size: 1.45rem; }
.po-muted { color: var(--text-muted); }
.po-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.po-columns { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.po-columns-even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .po-columns, .po-columns-even { grid-template-columns: 1fr; } }
.po-table-wrap { overflow-x: auto; }

/* Liste */
.po-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.po-search { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-muted); }
.po-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: 0.88rem; outline: none; }
.po-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-hover); border: 1px solid var(--border-color); }
.po-seg button { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.82rem; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.po-seg button.on { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.po-list { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.po-list th { text-align: left; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.po-list td { padding: 11px 10px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.po-list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.po-list tbody tr[data-po-open] { cursor: pointer; transition: background 0.15s; }
.po-list tbody tr[data-po-open]:hover, .po-list tbody tr[data-po-open]:focus-visible { background: var(--bg-hover); outline: none; }
.po-status { display: inline-flex; font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.po-status-draft { background: var(--bg-hover); color: var(--text-muted); border-color: var(--border-color); }
.po-status-waiting { background: rgba(245, 158, 11, 0.12); color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); }
.po-status-partial { background: rgba(96, 165, 250, 0.12); color: #60a5fa; border-color: rgba(96, 165, 250, 0.3); }
.po-status-done { background: rgba(34, 197, 94, 0.12); color: #22c55e; border-color: rgba(34, 197, 94, 0.3); }
.po-progress { height: 4px; border-radius: 4px; background: var(--bg-hover); margin-top: 6px; overflow: hidden; max-width: 120px; }
.po-progress span { display: block; height: 100%; background: #22c55e; border-radius: 4px; }
.po-bar { height: 4px; border-radius: 4px; background: var(--bg-hover); margin-top: 5px; overflow: hidden; }
.po-bar span { display: block; height: 100%; background: linear-gradient(90deg, #e30a17, #ff5a5f); }

/* Bekleyen ürünler */
.po-pending-list { display: flex; flex-direction: column; gap: 6px; max-height: 560px; overflow-y: auto; }
.po-pending-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border-color); cursor: pointer; transition: background 0.15s; }
.po-pending-item:hover { background: var(--bg-hover); }
.po-pending-item input { margin-top: 3px; width: 16px; height: 16px; accent-color: #22c55e; flex-shrink: 0; }
.po-pending-item strong { display: block; font-size: 0.88rem; }
.po-pending-item small { display: block; color: var(--text-muted); font-size: 0.76rem; margin-top: 2px; }

/* Sipariş dosyası */
.po-order-head h1 { margin: 4px 0; }
.po-title-input { font: inherit; color: inherit; background: transparent; border: 1px dashed transparent; border-radius: 8px; padding: 2px 6px; margin-left: -7px; width: min(560px, 100%); }
.po-title-input:hover { border-color: var(--border-color); }
.po-title-input:focus { outline: none; border-color: var(--primary); background: var(--bg-surface); }
.po-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-secondary); font-size: 0.86rem; }
.po-meta i { margin-right: 4px; opacity: 0.7; }
.po-savestate { font-weight: 600; }
.po-savestate.ok { color: #22c55e; }
.po-savestate.busy { color: var(--text-muted); }
.po-savestate.err { color: #ef4444; }
.po-more { position: relative; }
.po-icon-btn { width: 38px; padding: 0 !important; justify-content: center; }
.po-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-surface-opaque, var(--bg-surface)); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.5); }
.po-menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-primary); font: inherit; font-size: 0.88rem; cursor: pointer; text-align: left; }
.po-menu button:hover { background: var(--bg-hover); }
.po-menu button.danger { color: #ef4444; }

.po-editor { padding: 0 !important; overflow: hidden; margin-bottom: 20px; }
.po-items { width: 100%; border-collapse: collapse; min-width: 1180px; table-layout: fixed; }
.po-items th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); padding: 12px 8px; background: var(--bg-hover); border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.po-items td { padding: 5px 6px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.po-items tr:last-child td { border-bottom: 0; }
.po-items input[data-f] { width: 100%; min-width: 0; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-primary); font: inherit; font-size: 0.88rem; transition: border-color 0.15s, background 0.15s; }
.po-items tr:hover input[data-f] { border-color: var(--border-color); }
.po-items input[data-f]:focus { outline: none; border-color: var(--primary); background: var(--bg-surface); }
.po-items input.invalid { border-color: #ef4444 !important; }
.po-items .c-no { width: 36px; text-align: center; color: var(--text-muted); font-size: 0.8rem; font-weight: 700; }
.po-items .c-name { width: 22%; }
.po-items .c-qty { width: 76px; }
.po-items .c-qty input, .po-items .c-price input { text-align: right; font-variant-numeric: tabular-nums; }
.po-items .c-cat { width: 12%; }
.po-items .c-price { width: 148px; }
.po-items .c-total { width: 124px; text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; padding-right: 12px; }
.po-items .c-req { width: 16%; }
.po-items .c-note { width: 16%; }
.po-items .c-rec { width: 58px; text-align: center; }
.po-items .c-del { width: 36px; text-align: center; }
.po-price { display: flex; align-items: center; gap: 4px; }
.po-cur { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-hover); color: var(--text-secondary); font-weight: 800; cursor: pointer; transition: all 0.15s; }
.po-cur:hover { border-color: var(--primary); color: var(--text-primary); }
.po-cur.usd { background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.45); color: #22c55e; }
.po-check { position: relative; display: inline-grid; place-items: center; cursor: pointer; }
.po-check input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.po-check span { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--border-color-hover, var(--border-color)); display: grid; place-items: center; transition: all 0.15s; }
.po-check input:checked + span { background: #22c55e; border-color: #22c55e; }
.po-check input:checked + span::after { content: ''; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.po-check input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.po-check input:disabled + span { opacity: 0.5; }
.po-items tr.is-received td { background: rgba(34, 197, 94, 0.05); }
.po-items tr.is-received .c-name input { text-decoration: line-through; text-decoration-color: rgba(34, 197, 94, 0.6); }
.po-del { width: 28px; height: 28px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; opacity: 0.5; }
.po-items tr:hover .po-del { opacity: 1; }
.po-del:hover { color: #ef4444; border-color: rgba(239, 68, 68, 0.35); }
.po-editor-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--border-color); background: var(--bg-hover); }
.po-hint { color: var(--text-muted); font-size: 0.8rem; }
.po-hint kbd { font: inherit; font-size: 0.74rem; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-color); background: var(--bg-surface); }

.po-bottom { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .po-bottom { grid-template-columns: 1fr; } }
.po-bottom h2 { font-size: 1rem; margin: 0 0 12px; }
.po-note-panel textarea { width: 100%; min-height: 130px; resize: vertical; padding: 12px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 0.9rem; line-height: 1.5; }
.po-note-panel textarea:focus { outline: none; border-color: var(--primary); }
.po-sum-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border-color); color: var(--text-secondary); font-size: 0.9rem; }
.po-sum-row b { color: var(--text-primary); }
.po-sum-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(227, 10, 23, 0.08); border: 1px solid rgba(227, 10, 23, 0.25); }
.po-sum-total span { color: var(--text-secondary); font-size: 0.85rem; font-weight: 600; }
.po-sum-total b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.po-sum-total.usd { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.3); }

/* Raporlar */
.po-chart-panel { margin-bottom: 20px; }
.po-chart { position: relative; height: 300px; }
.po-report td { padding: 9px 10px; }
