@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --paper: #EAE4D8;
  --paper-light: #F1ECE1;
  --ink: #241F1C;
  --brass: #A6763E;
  --brass-light: #C9A876;
  --sage: #5B7461;
  --rust: #9C4A3B;
  --radius-sm: 7px;
  --radius-md: 10px;
  --shadow-sm: 0 1px 3px rgba(36,31,28,0.07);
  --shadow-md: 0 4px 14px rgba(36,31,28,0.10);
  --shadow-lg: 0 12px 32px rgba(36,31,28,0.16);
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  font-family: 'Inter', sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.mono { font-family: 'IBM Plex Mono', monospace; }
.eyebrow { font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; color: var(--brass); }
button { touch-action: manipulation; font-family: inherit; }
img, svg, video, canvas { max-width: 100%; }
input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #241F1C22; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #241F1C3d; }

/* ---------- login ---------- */
.login-screen { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 30% 20%, #F1ECE1 0%, var(--paper) 60%); }
.login-card {
  background: repeating-linear-gradient(135deg, var(--paper-light) 0px, var(--paper-light) 10px, #EDE7DA 10px, #EDE7DA 20px);
  border: 1.5px dashed var(--brass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: clamp(24px, 6vw, 32px);
  width: 100%;
  max-width: 340px;
  position: relative;
}
.login-card::after {
  content: "\2702  - - - - - - - - - - - - - - - - - -";
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 11px;
  color: #241F1C55;
  letter-spacing: 0.05em;
}
.login-card h1 { font-family: 'Oswald', sans-serif; text-transform: uppercase; margin: 8px 0 20px; font-size: clamp(20px, 5vw, 24px); }
.login-card input { width: 100%; padding: 10px; margin-bottom: 12px; border: 2px solid #241F1C33; border-radius: var(--radius-sm); font-size: 14px; }
.login-card button { width: 100%; padding: 12px; background: var(--ink); color: var(--paper); border: none; border-radius: var(--radius-sm); font-family: 'Oswald', sans-serif; text-transform: uppercase; cursor: pointer; transition: background 0.15s; }
.login-card button:hover { background: var(--brass); }
.error-text { color: var(--rust); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ---------- app shell: sidebar + main ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.sidebar-brand { padding: 24px 20px 16px; border-bottom: 1px solid #EAE4D822; }
.sidebar-brand .eyebrow { color: var(--brass-light); }
.brand-title { font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 20px; font-weight: 600; margin-top: 4px; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: transparent; border: none; color: #EAE4D8CC; padding: 11px 14px;
  border-radius: var(--radius-sm); font-family: 'Oswald', sans-serif; text-transform: uppercase;
  font-size: 13px; letter-spacing: 0.02em; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.nav-btn .nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-btn:hover { background: #EAE4D815; color: var(--paper); }
.nav-btn.active { background: var(--brass); color: var(--ink); font-weight: 600; }

.sidebar-footer { padding: 16px; border-top: 1px solid #EAE4D822; }
.user-chip { margin-bottom: 12px; }
.user-chip-name { font-weight: 600; font-size: 14px; }
.user-chip-role { font-size: 11px; color: #EAE4D899; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px; }
.full-width { width: 100%; }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  border-bottom: 2px solid #241F1C1a; padding: 16px clamp(16px, 3vw, 28px); display: flex;
  align-items: center; justify-content: space-between; gap: 16px; background: var(--paper);
  position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
}
.search-box { position: relative; flex: 1; min-width: 160px; max-width: 420px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #241F1C66; font-size: 15px; }
.search-box input { width: 100%; padding: 10px 12px 10px 34px; border: 2px solid #241F1C22; border-radius: var(--radius-sm); font-size: 14px; background: white; }

.primary-btn { background: var(--ink); color: var(--paper); border: none; padding: 10px 18px; border-radius: var(--radius-sm); font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 13px; cursor: pointer; transition: background 0.12s; white-space: nowrap; }
.primary-btn:hover { background: var(--brass); }
.ghost-btn { background: transparent; border: 2px solid #241F1C33; padding: 9px 15px; border-radius: var(--radius-sm); font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 12px; cursor: pointer; color: var(--ink); transition: border-color 0.12s, color 0.12s; white-space: nowrap; }
.ghost-btn:hover { border-color: var(--brass); color: var(--brass); }

.content { padding: clamp(16px, 3vw, 24px) clamp(16px, 3vw, 28px) 60px; flex: 1; min-width: 0; }
.tab-panel.hidden { display: none; }

/* ---------- stat strip ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-box { background: var(--ink); border-radius: var(--radius-md); padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm); }
.stat-box.accent { background: var(--brass); }
.stat-box-icon { font-size: 20px; flex-shrink: 0; line-height: 1; }
.stat-num { font-family: 'IBM Plex Mono', monospace; font-size: clamp(18px, 3vw, 22px); font-weight: 600; color: var(--paper-light); }
.stat-box.accent .stat-num { color: var(--ink); }
.stat-label { font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 10px; color: #F1ECE199; margin-top: 2px; letter-spacing: 0.03em; }
.stat-box.accent .stat-label { color: #241F1Ccc; }

/* ---------- dashboard cards ---------- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.depot-card { background: var(--paper-light); border: 2px solid #241F1C1a; border-left: 3px solid #241F1C22; border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-sm); transition: box-shadow 0.12s; }
.depot-card.completed { border-left-color: var(--sage); }
.depot-card.partial { border-left-color: var(--brass); }
.depot-card.empty { border-left-color: var(--rust); }
.depot-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.depot-card h3 { font-family: 'Oswald', sans-serif; text-transform: uppercase; margin: 0; font-size: 16px; word-break: break-word; }
.depot-status-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.depot-status-dot.done { background: #5B746122; color: var(--sage); }
.depot-status-dot.partial { background: #A6763E22; color: var(--brass); }
.depot-status-dot.empty { background: #9C4A3B22; color: var(--rust); }
.depot-card .total { font-family: 'IBM Plex Mono', monospace; font-size: 26px; font-weight: 600; }
.depot-progress { height: 4px; background: #241F1C14; border-radius: 2px; overflow: hidden; margin-top: 8px; }
.depot-progress-fill { height: 100%; }
.depot-progress-fill.done { width: 100%; background: var(--sage); }
.depot-progress-fill.partial { width: 55%; background: var(--brass); }
.depot-progress-fill.empty { width: 0%; background: var(--rust); }
.depot-card .status { font-size: 12px; margin-top: 6px; }
.depot-card .status.done { color: var(--sage); }
.depot-card .status.pending { color: var(--rust); }
.depot-card .items { margin-top: 10px; font-size: 12px; color: #241F1C99; max-height: 120px; overflow-y: auto; }
.depot-card .items div { display: flex; justify-content: space-between; padding: 2px 0; align-items: center; gap: 8px; }
.depot-card-clickable { cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.depot-card-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-hint { margin-top: 10px; font-size: 12px; color: #241F1C77; font-style: italic; }
.depot-card-title { text-decoration: underline; text-decoration-color: transparent; transition: text-decoration-color 0.15s; }
.depot-card-clickable:hover .depot-card-title { text-decoration-color: var(--brass); }
.more-note { font-style: italic; padding-top: 4px; opacity: 0.7; }
.empty-note { color: #241F1C66; font-style: italic; font-size: 14px; padding: 20px 0; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(36,31,28,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-box {
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius-md);
  padding: clamp(18px, 5vw, 28px); width: 100%; max-width: 640px; max-height: 85vh; overflow-y: auto;
  position: relative;
}
/* depo detayı tablo içerdiği için biraz daha geniş bir modal alanı kullanır */
#depot-modal .modal-box { max-width: 780px; }
.modal-close-btn {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  font-size: 18px; cursor: pointer; color: #241F1C99;
}
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding-right: 30px; flex-wrap: wrap; gap: 10px; }
.modal-header h2 { font-family: 'Oswald', sans-serif; text-transform: uppercase; margin: 4px 0 0; font-size: clamp(19px, 4vw, 24px); word-break: break-word; }
.modal-total { text-align: right; }
.modal-total .total { font-family: 'IBM Plex Mono', monospace; font-size: 26px; font-weight: 600; }

.complete-toggle-btn {
  margin-top: 14px; width: 100%; padding: 10px; border-radius: var(--radius-sm);
  border: 2px solid #241F1C33; background: transparent;
  font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 12px; cursor: pointer;
}
.complete-toggle-btn.done { background: var(--sage); border-color: var(--sage); color: white; }

.finalize-btn {
  margin-top: 8px; width: 100%; padding: 10px; border-radius: var(--radius-sm);
  border: 2px solid var(--rust); background: transparent; color: var(--rust);
  font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 12px; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.finalize-btn:hover:not(:disabled) { background: var(--rust); color: white; }
.finalize-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.qty-big { font-family: 'IBM Plex Mono', monospace; font-size: 20px; font-weight: 600; flex-shrink: 0; margin-top: 1px; }

/* Arşiv Kaydı modalındaki ürün satırları: ad solda, miktar sağda, aralarında ince ayraç */
.modal-item-list { margin-top: 10px; }
.modal-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid #241F1C1A;
}
.modal-item-row:last-child { border-bottom: none; }
.modal-item-row .main-text { font-weight: 500; word-break: break-word; }
.modal-item-row .sub-text { font-size: 12px; color: #241F1C99; font-family: 'IBM Plex Mono', monospace; margin-top: 2px; }
.modal-del-btn { background: none; border: none; color: var(--rust); cursor: pointer; font-size: 17px; flex-shrink: 0; }
.del-btn { background: none; border: none; color: var(--rust); cursor: pointer; font-size: 16px; flex-shrink: 0; }

/* ---------- depo detayı: RMOS tarzı sütunlu tablo ---------- */
.depot-table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid #241F1C1a; border-radius: var(--radius-sm); }
.depot-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.depot-table thead th {
  background: var(--ink); color: var(--paper); text-align: left; padding: 9px 12px;
  font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 10.5px;
  letter-spacing: 0.03em; font-weight: 600; white-space: nowrap;
}
.depot-table thead th.col-num { text-align: right; }
.depot-table tbody td { padding: 8px 12px; border-bottom: 1px solid #241F1C10; vertical-align: middle; }
.depot-table tbody tr:last-child td { border-bottom: none; }
.depot-table tbody tr:nth-child(even):not(.sub-row) { background: var(--paper-light); }
.depot-table .col-num { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.depot-table .col-muted { color: #241F1C99; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.depot-table .col-action { width: 32px; text-align: center; }
.depot-table .qty-cell { font-weight: 700; color: var(--brass); font-size: 14px; }
.depot-table .group-row td { font-weight: 600; border-bottom: none; }
.depot-table .sub-row td { padding-top: 3px; padding-bottom: 3px; background: transparent; }
.depot-table .sub-row td:nth-child(3) { padding-left: 26px; }
.depot-table .sub-row:last-of-type td { border-bottom: 1px solid #241F1C10; }

/* ---------- analiz / grafik ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.chart-card { background: var(--paper-light); border: 2px solid #241F1C14; border-radius: var(--radius-md); padding: 20px; position: relative; box-shadow: var(--shadow-sm); min-width: 0; }
.chart-card h3 { font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 14px; margin: 0 0 16px; color: #241F1C99; }
.chart-card canvas { max-height: 320px; }
.chart-card-wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

/* ---------- import box ---------- */
.import-box {
  background: var(--paper-light); border: 2px dashed #A6763E66; border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 16px; display: flex; justify-content: space-between;
  align-items: center; gap: 16px; flex-wrap: wrap;
}
.import-box-text { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.import-box-text span { font-size: 12px; color: #241F1C99; }
.import-box-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.file-label { cursor: pointer; display: inline-flex; align-items: center; }
.import-result { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.import-result.success { background: #5B746120; color: var(--sage); border: 1px solid var(--sage); }
.import-result.error { background: #9C4A3B20; color: var(--rust); border: 1px solid var(--rust); }

/* ---------- forms & lists ---------- */
.inline-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1; min-width: 160px; padding: 10px; border: 2px solid #241F1C33; border-radius: var(--radius-sm); font-size: 14px; }
.inline-form button { background: var(--ink); color: var(--paper); border: none; padding: 0 20px; border-radius: var(--radius-sm); font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 13px; cursor: pointer; min-height: 42px; transition: background 0.12s; }
.inline-form button:hover { background: var(--brass); }

/* ---------- ürün kataloğu: kategori filtre çubuğu ---------- */
.category-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.category-chip {
  background: var(--paper-light); border: 2px solid #241F1C1a; border-radius: 999px;
  padding: 7px 13px; font-size: 12.5px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: border-color 0.12s, background 0.12s;
  white-space: nowrap;
}
.category-chip:hover { border-color: var(--brass); }
.category-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-count {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 700;
  background: #241F1C14; padding: 1px 6px; border-radius: 999px;
}
.category-chip.active .chip-count { background: #EAE4D822; }
.p-icon { font-size: 17px; flex-shrink: 0; line-height: 1.3; margin-top: 1px; }

.data-list { display: flex; flex-direction: column; gap: 8px; }
/* ---------- Sayım Birleştir ---------- */
.merge-section { margin-top: 24px; }
.merge-open-btn {
  background: var(--paper-light); border: 2px dashed var(--brass); border-radius: var(--radius-md);
  padding: 14px 20px; font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 13.5px;
  font-weight: 600; color: var(--ink); cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.merge-open-btn:hover { background: var(--paper); border-color: var(--ink); }
.merge-depot-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; max-height: 300px; overflow-y: auto; }
.merge-depot-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--paper-light); border: 1px solid #241F1C1a; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px;
}
.merge-depot-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.merge-depot-item .merge-depot-name { font-weight: 500; flex: 1; }
.merge-depot-item .merge-depot-total { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: #241F1C99; }
.merge-name-row { margin-top: 16px; }

.data-row { background: var(--paper-light); border: 1px solid #241F1C1a; border-radius: var(--radius-sm); padding: 18px 26px; display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 4px; }
.data-row .main-text { font-weight: 500; word-break: break-word; }
.data-row .sub-text { font-size: 12px; color: #241F1C99; font-family: 'IBM Plex Mono', monospace; }

.row-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.edit-btn { background: none; border: none; color: var(--brass); cursor: pointer; font-size: 15px; }

.depot-mgmt-row { align-items: center; }
.depot-mgmt-main { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; flex: 1; min-width: 200px; }
.due-date-box { display: flex; flex-direction: column; gap: 4px; }
.due-date-label { font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 10.5px; color: #241F1C77; letter-spacing: 0.03em; }
.due-date-input { border: 1.5px solid #241F1C33; border-radius: 5px; padding: 5px 8px; font-size: 12.5px; font-family: 'IBM Plex Mono', monospace; background: white; }
.overdue-tag { background: var(--rust); color: white; font-size: 9.5px; padding: 1px 6px; border-radius: 4px; margin-left: 4px; letter-spacing: 0.02em; }
.rename-input { width: 100%; padding: 6px 8px; border: 2px solid var(--brass); border-radius: 4px; font-size: 14px; }

.history-row .sub-text { font-family: 'Inter', sans-serif; }
.you-badge { background: var(--brass); color: white; font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: 6px; text-transform: uppercase; }

/* ---------- responsive: tablet ve altı ---------- */
@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-footer { border-top: none; display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
  .user-chip { margin-bottom: 0; }
  .full-width { width: auto; }
  .topbar { flex-wrap: wrap; }
  .search-box { min-width: 100%; order: 3; }
}

/* ---------- responsive: telefon (≤480px) ---------- */
@media (max-width: 480px) {
  .sidebar-brand { padding: 16px 14px 12px; }
  .sidebar-nav { padding: 8px; }
  .nav-btn { font-size: 12px; padding: 9px 10px; }
  .content { padding: 14px 12px 40px; }
  .inline-form input, .inline-form select { min-width: 100%; }
  .modal-box { padding: 18px; }
}
