@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #f2f1f8;
  --surface: #ffffff;
  --border: #e2dff2;
  --border-strong: #c8c4e0;
  --text: #1a1917;
  --text-2: #6b6a65;
  --text-3: #9e9c96;
  --purple: #4c45a5;
  --purple-light: #eeedfe;
  --purple-text: #3c3489;
  --green: #2d7a4f;
  --green-light: #e8f5ed;
  --amber: #b06a0a;
  --amber-light: #fef3e2;
  --red: #c0392b;
  --red-light: #fdecea;
  --blue: #1a5fa5;
  --blue-light: #e8f1fb;
  --primary: #4c45a5;
  --primary-light: #eeedfe;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(76,69,165,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card: 0 2px 8px rgba(76,69,165,0.10);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15), 0 8px 24px rgba(76,69,165,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "zero" 0; }
/* Inter tüm form elemanları için garantile (bazı tarayıcılar body'den miras almaz) */
input, select, textarea, button { font-family: var(--font); font-feature-settings: "zero" 0; }
.mono { font-family: var(--mono) !important; -webkit-font-smoothing: subpixel-antialiased; }

/* LOGIN */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 48px 40px; width: 380px; box-shadow: var(--shadow); }
.login-logo { margin-bottom: 16px; text-align: center; }
.login-sub { font-size: 13px; color: var(--text-2); margin-bottom: 32px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; letter-spacing: 0.02em; text-transform: uppercase; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font); font-size: 15px;
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(76,69,165,0.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ── Modern select — tüm sistemde OS oku kaldır, custom chevron ── */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%239e9c96' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 28px !important;
  cursor: pointer;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:hover:not(:focus) { border-color: var(--border-strong); }
select:focus { border-color: var(--purple) !important; box-shadow: 0 0 0 3px rgba(76,69,165,0.12); outline: none; }
/* Küçük inline select'ler (tablo içi hizmet seçici vb.) */
select[style*="font-size:11px"], select[style*="font-size: 11px"],
.cari-hizmet-sel {
  padding-right: 22px !important;
  background-position: right 5px center;
}

/* ── Form-group hover state ── */
.form-group input:hover:not(:focus),
.form-group select:hover:not(:focus),
.form-group textarea:hover:not(:focus) {
  border-color: var(--border-strong);
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-family: var(--font);
  font-size: 13px; font-weight: 500; cursor: pointer; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.1s;
  text-decoration: none; white-space: nowrap; outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.btn:hover { background: var(--bg); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-primary { background: var(--purple); color: #fff; border-color: var(--purple); box-shadow: 0 1px 4px rgba(76,69,165,0.25); }
.btn-primary:hover { background: var(--purple-text); border-color: var(--purple-text); box-shadow: 0 2px 8px rgba(76,69,165,0.35); }
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(76,69,165,0.22); }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: var(--red-light); color: var(--red); border-color: transparent; }
.btn-danger:hover { background: #fbd5d1; }
.btn-override { background: #F5C400; color: #000; border-color: #d4ab00; font-weight: 700; letter-spacing: 0.5px; }
.btn-override:hover { background: #d4ab00; color: #000; border-color: #b89600; }
.btn-success { background: var(--green-light); color: var(--green); border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.error-msg { background: var(--red-light); color: var(--red); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.success-msg { background: var(--green-light); color: var(--green); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }

/* APP SHELL */
body::before { content: ''; display: block; height: 4px; background: linear-gradient(90deg, var(--purple) 0%, #7b6fe0 60%, #a78bfa 100%); position: fixed; top: 0; left: 0; right: 0; z-index: 9999; }
.shell { display: flex; min-height: 100vh; padding-top: 4px; }

/* SIDEBAR */
.sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 4px; left: 0; bottom: 0; z-index: 10; overflow: visible; }
.sidebar-header { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, var(--purple-light) 0%, var(--surface) 100%); }
.sidebar-logo { line-height: 0; }
.sidebar-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.sidebar-user { margin: 12px; padding: 10px 12px; background: var(--bg); border-radius: var(--radius-sm); display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--purple-light); color: var(--purple-text); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.user-name { font-size: 12px; font-weight: 500; color: var(--text); }
.user-role { font-size: 11px; color: var(--text-3); }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-group { overflow: hidden; }
.nav-group-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 4px; font-size: 15.5px; font-weight: 800; color: var(--text-2); letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; user-select: none; transition: color 0.12s; }
.nav-group-header:hover { color: var(--purple-text); }
.nav-chevron { font-size: 14px; transition: transform 0.2s ease; opacity: 0.6; }
.nav-group-items { overflow: hidden; max-height: 0; transition: max-height 0.25s ease; }
.nav-group.open > .nav-group-items { max-height: 800px; }
.nav-group.open > .nav-group-header .nav-chevron { transform: rotate(180deg); opacity: 1; }
.nav-section { padding: 8px 12px 4px; font-size: 14px; font-weight: 600; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 20px; font-size: 17px; color: var(--text-2); cursor: pointer; transition: all 0.12s; border-left: 2px solid transparent; margin: 1px 0; text-decoration: none; min-height: 44px; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--purple-light); color: var(--purple-text); font-weight: 500; border-left-color: var(--purple); }
.nav-icon { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

/* ── Sidebar Collapse Toggle (desktop only) ── */
@media (min-width: 901px) {
  .sidebar { transition: width .22s ease; }
}
.sidebar-collapse-btn {
  position: absolute; right: -13px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--border);
  cursor: pointer; z-index: 12;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text-2);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  transition: background .15s, color .15s;
  user-select: none;
}
.sidebar-collapse-btn:hover { background: var(--purple); color: #fff; border-color: var(--purple); }

/* Collapsed sidebar */
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .sidebar-header { padding: 14px 8px; justify-content: center; }
.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-user { padding: 8px; justify-content: center; }
.sidebar.collapsed .sidebar-user > div:last-child { display: none; }
.sidebar.collapsed .nav-group-header { display: none; }
.sidebar.collapsed .nav-group-items { max-height: 800px !important; }
.sidebar.collapsed .nav-item { padding: 11px 0; justify-content: center; border-left: none; border-radius: 8px; margin: 2px 4px; position: relative; font-size: 0; }
.sidebar.collapsed .nav-item .nav-icon { width: auto; margin: 0; font-size: 18px; }
.sidebar.collapsed .nav-item > *:not(.nav-icon) { display: none !important; }
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute; left: 58px; top: 50%; transform: translateY(-50%);
  background: #1e293b; color: #fff;
  padding: 5px 10px; border-radius: 7px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  pointer-events: none; z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.sidebar.collapsed .nav-section { display: none; }
.sidebar.collapsed .sidebar-footer .lang-flag-btns,
.sidebar.collapsed .sidebar-footer .lang-select-wrap,
.sidebar.collapsed .sidebar-footer .lang-switcher-wrap { display: none; }
.sidebar.collapsed .sidebar-footer { padding: 8px 4px; }

/* MAIN */
.main-content { margin-left: 220px; flex: 1; padding: 28px 32px; min-width: 0; }
@media (min-width: 901px) {
  .main-content { transition: margin-left .22s ease; }
  .main-content.sidebar-collapsed { margin-left: 56px; }
}

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; border-left: 4px solid var(--purple); padding: 12px 16px; background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; box-shadow: var(--shadow); }
.page-title { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.header-actions { display: flex; gap: 8px; }

/* STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--purple); border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: var(--shadow-card); transition: transform 0.15s, box-shadow 0.15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.09); }
.stat-card.stat-blue   { border-top-color: var(--blue); }
.stat-card.stat-purple { border-top-color: var(--purple); }
.stat-card.stat-amber  { border-top-color: var(--amber); }
.stat-card.stat-red    { border-top-color: var(--red); }
.stat-card.stat-green  { border-top-color: var(--green); }
.stat-icon { font-size: 20px; line-height: 1; margin-bottom: 10px; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; }
.stat-icon-blue   { background: var(--blue-light); }
.stat-icon-purple { background: var(--purple-light); }
.stat-icon-amber  { background: var(--amber-light); }
.stat-icon-red    { background: var(--red-light); }
.stat-icon-green  { background: var(--green-light); }
.stat-label { font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 5px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-change { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.stat-change.warn { color: var(--amber); }
.stat-change.danger { color: var(--red); }

/* TABLES */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow-card); }
.table-header { padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 8px; overflow: visible; min-width: 0; }
.table-header .table-title { flex-shrink: 0; }
.table-title { font-size: 16px; font-weight: 500; color: var(--text); }
.table-search {
  padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239e9c96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  color: var(--text);
  outline: none;
  width: 220px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.table-search:focus {
  border-color: var(--purple);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px rgba(76,69,165,0.12);
}
.table-search:hover:not(:focus) { border-color: var(--border-strong); }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 16px; text-align: left; font-size: 13px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg); border-bottom: 1px solid var(--border); white-space: normal; word-break: keep-all; hyphens: none; }
tbody td { padding: 12px 16px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafaf8; }
.mono { font-size: 12px; color: var(--text-2); }

/* COLUMN SEARCH ROW */
.col-search-row th { background: #f0eeff; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.col-search-input {
  width: 100%; padding: 5px 8px;
  border: 1.5px solid var(--border); border-radius: 4px;
  font-family: var(--font); font-size: 12px;
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.col-search-input:hover:not(:focus) { border-color: var(--border-strong); }
.col-search-input:focus { border-color: var(--purple); background: #fff; box-shadow: 0 0 0 2px rgba(76,69,165,0.10); }

/* EXPORT DROPDOWN */
.export-dropdown { position: relative; display: flex; align-items: stretch; }
.export-toggle { white-space: nowrap; }
.export-menu { display: none; position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); z-index: 50; min-width: 130px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.export-menu.open { display: block; }
.export-menu span { display: block; padding: 9px 14px; font-size: 13px; cursor: pointer; color: var(--text); transition: background 0.1s; }
.export-menu span:hover { background: var(--purple-light); color: var(--purple-text); }
.export-menu span + span { border-top: 1px solid var(--border); }

/* ── form-control / form-label (standalone inputs — guvenlik, log vb.) ── */
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; letter-spacing: 0.02em; }
input.form-control, textarea.form-control {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px;
  background: var(--surface); color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
input.form-control:focus, textarea.form-control:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(76,69,165,0.12);
}
input.form-control:hover:not(:focus), textarea.form-control:hover:not(:focus) {
  border-color: var(--border-strong);
}

/* ── Standalone select (filter bars, table headers, dışarıda kalan) ── */
select.form-control,
.filter-select,
.table-header select,
.pos-filtre-bar select {
  padding: 7px 30px 7px 10px !important;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  font-size: 13px;
  color: var(--text);
}

/* LANGUAGE SELECT (login) */
.lang-select-wrap { margin-bottom: 16px; }
.lang-select-wrap select { width: 100%; padding: 9px 30px 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; background-color: var(--bg); color: var(--text); }
.lang-select-wrap select:focus { border-color: var(--purple); }
.lang-flag-btns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 16px; }
#login-screen .lang-flag-btns { justify-content: center; }
.sidebar-footer .lang-flag-btn { width: calc(25% - 4px); justify-content: center; }
.lang-flag-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border-radius: 4px; padding: 2px 3px; border: 2px solid transparent; transition: border-color 0.15s, transform 0.1s; cursor: pointer; }
.lang-flag-btn img { display: block; border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.lang-flag-btn:hover { border-color: var(--purple-light); transform: scale(1.1); }
.lang-flag-btn.active { border-color: var(--purple); background: var(--purple-light); }

/* LANGUAGE SWITCHER TOGGLE */
.lang-switcher-wrap { margin-bottom: 8px; }
.lang-toggle-btn {
  display: flex; align-items: center; gap: 7px;
  width: 100%; padding: 5px 8px;
  background: var(--sidebar-item-hover, rgba(255,255,255,.06));
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 12px; font-weight: 500;
  cursor: pointer; text-align: left; transition: background .15s, border-color .15s;
}
.lang-toggle-btn:hover { background: var(--purple-light); border-color: var(--purple-light); color: var(--text); }
.lang-toggle-label { flex: 1; }
.lang-toggle-arrow { font-size: 10px; transition: transform .25s; line-height: 1; }
.lang-toggle-btn:not(.lang-toggle-closed) .lang-toggle-arrow { transform: rotate(180deg); }
#langFlagPanel { margin-top: 4px; }

/* BADGES */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 20px; }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-purple { background: var(--purple-light); color: var(--purple-text); }
.badge-gray { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }

/* ROLE BADGE */
.role-admin     { background: var(--purple-light); color: var(--purple-text); }
.role-personel  { background: var(--blue-light);   color: var(--blue); }
.role-musteri   { background: var(--green-light);  color: var(--green); }
.role-muhasebe  { background: #fff7ed; color: #c2410c; }
.role-depocu    { background: #f0fdf4; color: #15803d; }
.role-plasiyer  { background: #fef3c7; color: #92400e; }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1000; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.modal-overlay.open { display: flex; }

/* ── Old .modal pattern ── */
.modal { background: var(--surface); border-radius: 14px; padding: 28px 32px; width: 90vw; max-width: 90vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); position: relative; }
.modal-wide { width: 90vw; max-width: 90vw; }
.modal-xl   { width: 90vw; max-width: 90vw; }

/* ── New .modal-box pattern (.modal-overlay > .modal-box > .modal-header + .modal-body + .modal-footer) ── */
.modal-box { background: var(--surface); border-radius: 14px; width: 90vw; max-width: 90vw; max-height: 90vh; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.25); position: relative; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 700; color: var(--text); flex-shrink: 0; gap: 12px; min-height: 56px; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0; background: var(--surface); }
/* Close button inside .modal-header — override absolute positioning */
.modal-header .modal-close { position: static; flex-shrink: 0; margin-left: auto; }

/* ── Shared ── */
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 20px; color: var(--text); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.modal-close {
  position: absolute; top: 16px; right: 18px;
  width: 30px; height: 30px;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 20px; line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.modal-close:hover { background: var(--red-light); color: var(--red); }
/* Floating X outside modal — created by openModal() via .modal-wrap wrapper */
.modal-wrap { position: relative; }
.modal-wrap > .modal-close {
  position: absolute; top: -16px; right: -16px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.80);
  color: #fff;
  font-size: 22px; font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 3px 10px rgba(0,0,0,0.28);
  z-index: 10;
  transition: background 0.12s, transform 0.12s;
}
.modal-wrap > .modal-close:hover { background: rgba(220, 38, 38, 0.95); transform: scale(1.08); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ALERT */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-success { background: var(--green-light); color: var(--green); }
.alert-error { background: var(--red-light); color: var(--red); }
.alert-info { background: var(--blue-light); color: var(--blue); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty-state .empty-icon { font-size: 32px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* FILTER TABS */
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab { padding: 6px 12px; font-size: 12px; font-weight: 500; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text-2); cursor: pointer; transition: all 0.12s; font-family: var(--font); }
.filter-tab:hover { background: var(--bg); color: var(--text); }
.filter-tab.active { background: var(--purple-light); color: var(--purple-text); border-color: var(--purple); }

.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--text-2); font-size: 13px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* CUSTOMER VIEW HEADER */
.customer-header { background: var(--purple); color: #fff; padding: 20px 32px; margin: -28px -32px 28px; }
.customer-header h1 { font-size: 20px; font-weight: 600; }
.customer-header p { font-size: 13px; opacity: 0.75; margin-top: 4px; }

/* STATUS BADGES */
.siparis-durum-beklemede { background: var(--bg); color: var(--text-2); font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); }
.siparis-durum-isleme_alindi { background: var(--blue-light); color: var(--blue); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.siparis-durum-hazirlaniyor { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.siparis-durum-kargolandi { background: var(--purple-light); color: var(--purple-text); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.siparis-durum-tamamlandi { background: var(--green-light); color: var(--green); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.siparis-durum-iptal { background: var(--red-light); color: var(--red); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.oncelik-acil { background: var(--red-light); color: var(--red); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.oncelik-yuksek { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.oncelik-normal { background: var(--bg); color: var(--text-2); font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); }
.fatura-durum-bekliyor { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.fatura-durum-odendi { background: var(--green-light); color: var(--green); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.fatura-durum-gecikti { background: var(--red-light); color: var(--red); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.fatura-durum-iptal { background: var(--bg); color: var(--text-2); font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); }
.gorev-durum-bekliyor { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.gorev-durum-devam { background: var(--blue-light); color: var(--blue); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.gorev-durum-tamamlandi { background: var(--green-light); color: var(--green); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.gorev-oncelik-acil { background: var(--red-light); color: var(--red); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.gorev-oncelik-yuksek { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.gorev-oncelik-normal { background: var(--bg); color: var(--text-2); font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); }
.op-durum-bekliyor { background: var(--bg); color: var(--text-2); font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); }
.op-durum-hazirlaniyor { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.op-durum-tamamlandi { background: var(--green-light); color: var(--green); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.op-durum-incelemede { background: var(--blue-light); color: var(--blue); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.op-durum-stoka_iade { background: var(--green-light); color: var(--green); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.op-durum-imha { background: var(--red-light); color: var(--red); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.op-durum-musteri_iade { background: var(--purple-light); color: var(--purple-text); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.palet-durum-depoda { background: var(--blue-light); color: var(--blue); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.palet-durum-gonderildi { background: var(--green-light); color: var(--green); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.palet-durum-bekliyor { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.amazon-durum-aktif { background: var(--green-light); color: var(--green); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.amazon-durum-bekliyor { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.amazon-durum-hata { background: var(--red-light); color: var(--red); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.yasal-durum-bekliyor { background: var(--amber-light); color: var(--amber); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.yasal-durum-devam { background: var(--blue-light); color: var(--blue); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.yasal-durum-tamamlandi { background: var(--green-light); color: var(--green); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.yasal-durum-iptal { background: var(--bg); color: var(--text-2); font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); }

/* RAPOR */
.rapor-kart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.rapor-kart h3 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 14px; }

/* DASHBOARD COLS */
.dashboard-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }

/* TOAST */
#toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10000; display: flex; flex-direction: column; gap: 12px; align-items: center; pointer-events: none; }
.toast-item { padding: 20px 40px; border-radius: 14px; font-size: 17px; font-weight: 600; background: #1e1e1e; color: #fff; box-shadow: 0 8px 40px rgba(0,0,0,0.35); animation: toastIn 0.22s cubic-bezier(.34,1.56,.64,1); min-width: 280px; max-width: 600px; text-align: center; line-height: 1.4; }
.toast-item.success { background: var(--green); }
.toast-item.error { background: var(--red); }
.toast-item.warn { background: #f59e0b; color: #1a0000; }
.toast-item.info { background: var(--blue); }
@keyframes toastIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* FATURA DETAIL */
.fatura-detail { font-size: 13px; }
.fatura-detail table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fatura-kalem-row td { padding: 8px 12px; border-bottom: 1px solid var(--border); }

/* STOK LOW INDICATOR */
.stok-low { color: var(--red); font-weight: 600; }
.stok-ok { color: var(--green); }
.stok-zero { color: var(--red); font-weight: 700; }

/* =========================================
   MOBILE TOPBAR
   ========================================= */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.mobile-topbar-logo {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-radius: var(--radius-sm);
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 56px; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9;
}
.sidebar-overlay.open { display: block; }

/* BARKOD ÇUBUĞU */
.barkod-bar { display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:13px 18px; margin-bottom:16px; box-shadow:var(--shadow); }
.barkod-icon { font-size:22px; color:var(--text-3); flex-shrink:0; }
.barkod-input { flex:1; border:none; background:transparent; font-family:var(--font); font-size:15px; color:var(--text); outline:none; }
.barkod-input::placeholder { color:var(--text-3); }

/* =========================================
   TABLET (900px – 1200px)
   ========================================= */
@media (max-width: 1100px) {
  .main-content { padding: 24px 20px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =========================================
   MOBILE (≤ 900px) — sidebar slide-in
   ========================================= */
@media (max-width: 900px) {
  /* topbar */
  .mobile-topbar { display: flex; }

  /* sidebar: hidden off-screen, slide in as overlay */
  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 11;
    top: 56px;
    bottom: 0;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.18); }
  .sidebar-collapse-btn { display: none; }

  /* main: push down to clear topbar */
  .main-content { margin-left: 0; padding: 80px 14px 24px; max-width: 100%; }

  /* page header stack */
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
  .header-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .header-actions .btn { flex: 1; justify-content: center; min-width: 120px; }

  /* stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px 14px; }
  .stat-icon { width: 36px; height: 36px; font-size: 18px; margin-bottom: 8px; }
  .stat-value { font-size: 20px; }
  .stat-value { font-size: 22px; }

  /* tables: horizontal scroll */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-header { padding: 10px 14px; flex-direction: column; align-items: stretch; gap: 10px; }
  .table-search { width: 100%; }
  .filter-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }
  thead th { padding: 8px 12px; white-space: nowrap; }
  tbody td { padding: 10px 12px; white-space: nowrap; }

  /* form layout */
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-group { margin-bottom: 14px; }
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* prevents iOS zoom */
    padding: 12px 14px;
  }

  /* modals */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 24px 18px;
  }
  .modal-wide { width: 100%; }
  .modal-xl   { width: 100%; }
  .modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: -12px auto 20px;
  }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1; justify-content: center; padding: 12px; }

  /* buttons */
  .btn { padding: 11px 16px; }
  .btn-sm { padding: 9px 12px; font-size: 12px; }

  /* toast — stays centered on mobile too */
  #toast { top: 50%; left: 12px; right: 12px; transform: translateY(-50%); }
  .toast-item { min-width: unset; width: 100%; font-size: 15px; padding: 16px 24px; }

  /* login */
  .login-box { width: 100%; max-width: 380px; padding: 32px 24px; border-radius: 12px; }
  #login-screen { padding: 16px; align-items: center; }

  /* customer header */
  .customer-header { padding: 16px; margin: -80px -14px 20px; }

  /* rapor */
  .rapor-kart { padding: 14px; }

  /* dashboard */
  .dashboard-cols { grid-template-columns: 1fr; }

  /* override inline grid styles */
  .stats-grid[style] { grid-template-columns: 1fr 1fr !important; }
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* siparis/fatura detay grid */
  .modal [style*="grid-template-columns:1fr 1fr"],
  .modal [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
}

/* =========================================
   SMALL PHONES (≤ 480px)
   ========================================= */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 10px 12px; }
  .stat-value { font-size: 18px; }
  .page-title { font-size: 19px; }
  .mobile-topbar-logo { font-size: 14px; }
  table { min-width: 480px; }
  .header-actions .btn { min-width: unset; font-size: 12px; padding: 10px 12px; }
}

/* DOWNLOAD DROPDOWN */
.dl-drop { position: relative; display: inline-block; }
.dl-drop > summary { list-style: none; cursor: pointer; }
.dl-drop > summary::-webkit-details-marker { display: none; }
.dl-drop > summary::marker { content: ''; }
.dl-drop[open] > summary { background: var(--bg); }
.dl-caret { font-size: 9px; opacity: .7; margin-left: 2px; }
.dl-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 6px 22px rgba(0,0,0,.16);
  min-width: 160px; z-index: 9990; padding: 4px;
}
.dl-menu a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; font-size: 12px; color: var(--text);
  text-decoration: none; border-radius: var(--radius-sm); white-space: nowrap;
}
.dl-menu a:hover { background: var(--bg); }
.dl-menu .dl-ico { font-size: 13px; width: 16px; text-align: center; }
