/* Theme variables are loaded from /static/css/themes.css */
*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}

/* ===== SIDEBAR LAYOUT ===== */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg, var(--panel));
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.2s ease;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  min-height: 60px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
}

.sidebar-brand:hover {
  text-decoration: none;
  opacity: 0.85;
}

.sidebar-logo {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.sidebar-toggle .icon-expand {
  display: none;
}

/* User Info */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav a:hover {
  background: var(--accent-bg);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  margin-left: -3px;
}

.sidebar-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-nav a span {
  transition: opacity 0.2s ease;
}

.sidebar-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 12px;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.sidebar-theme {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin-bottom: 8px;
}

.sidebar-theme svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.sidebar-theme select {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 28px 6px 10px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239fb0c6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: opacity 0.2s ease;
}

.sidebar-theme select:hover {
  border-color: var(--accent);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--danger) !important;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logout:hover {
  background: var(--danger-bg);
  text-decoration: none;
}

.sidebar-logout svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-logout span {
  transition: opacity 0.2s ease;
}

/* ===== COLLAPSED STATE ===== */
.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .user-name,
.sidebar-collapsed .sidebar-nav a span,
.sidebar-collapsed .sidebar-logout span,
.sidebar-collapsed .sidebar-theme select {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-toggle .icon-collapse {
  display: none;
}

.sidebar-collapsed .sidebar-toggle .icon-expand {
  display: block;
}

.sidebar-collapsed .sidebar-brand {
  justify-content: center;
}

.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: 12px 8px;
}

.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: 10px 8px;
}

.sidebar-collapsed .sidebar-theme {
  justify-content: center;
  padding: 8px;
}

.sidebar-collapsed .sidebar-logout {
  justify-content: center;
  padding: 10px 8px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}

.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== GENERAL STYLES ===== */
h1{margin:14px 0 10px}
h2{margin:0 0 10px; font-size:18px}

/* Page Header with Action Button */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-header h1 {
  margin: 0;
}
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.btn-add:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

/* ===== FILTER BAR ===== */
.filter-bar {
  background: var(--panel-hover);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 15px 0;
}

.filter-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.date-range-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-range-group label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-inputs span {
  color: var(--muted);
}

.date-inputs input[type="date"] {
  min-width: 130px;
  flex: none;
}

.filter-row-bottom {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

/* Filter bar içindeki Select2 */
.filter-bar .select2-container {
  min-width: 180px;
}

.filter-bar .select2-container--default .select2-selection--single {
  height: 36px !important;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.filter-bar .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 34px !important;
  color: var(--text);
  padding-left: 12px;
}

.filter-bar .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 34px !important;
}

.filter-bar .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--muted);
}

/* Task form stilleri */
.task-form input:focus,
.task-form select:focus,
.task-form textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: none;
}

.task-form .link-row {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.task-form .link-row > label:first-child {
  flex: 0 0 200px;
}

.task-form .link-row .link-field {
  flex: 1;
}

.task-form .select2-container--default .select2-selection--single {
  height: 42px !important;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-form .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 40px !important;
  color: var(--text);
  padding-left: 12px;
}

.task-form .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px !important;
}

.task-form .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--muted);
}

/* Primary action button */
.button.primary-action {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 12px 24px;
  font-size: 15px;
}

.button.primary-action:hover {
  background: var(--accent-hover);
}

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

.form-control {
  height: 36px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-control::placeholder {
  color: var(--muted);
}

/* Date input icon color */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

input.form-control {
  min-width: 240px;
  flex: 1;
}

select.form-control {
  min-width: 100px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239fb0c6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.btn-filter {
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: filter 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-filter:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.btn-filter.btn-clear {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.btn-filter.btn-clear:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Filters container (form with select) */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--panel-hover);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 15px;
}

.filters select {
  height: 36px;
  padding: 0 32px 0 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239fb0c6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 250px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* Select2 overrides for theme compatibility */
.select2-container--default .select2-selection--single {
  height: 36px;
  padding: 4px 12px;
  font-size: 14px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text);
  line-height: 26px;
  padding-left: 0;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 34px;
}

.select2-dropdown {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  padding: 8px 10px;
}

.select2-container--default .select2-results__option {
  padding: 8px 12px;
  color: var(--text);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--accent);
  color: var(--bg);
}

.select2-container--default .select2-results__option[aria-selected=true] {
  background: var(--accent-bg);
}

/* Modal içindeki Select2 için düzeltmeler */
.modal .select2-container--default .select2-selection--single {
  height: 42px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
}

.modal .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 28px;
  padding-right: 24px;
}

.modal .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px;
  top: 0;
}

.modal .select2-container--default .select2-selection--single .select2-selection__clear {
  margin-right: 20px;
  font-size: 18px;
}

/* Genel Select2 height düzeltmesi */
.select2-container .select2-selection--single {
  height: 38px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 36px !important;
  padding-left: 8px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px !important;
}

/* Alert Messages */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: var(--ok-bg, rgba(40, 167, 69, 0.15));
  border: 1px solid var(--ok);
  color: var(--ok);
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.alert-close:hover {
  opacity: 1;
}
.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:14px;
  padding:14px;
  margin:14px 0;
}
.muted{color:var(--muted)}
.form-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  overflow: hidden;
}
.form-grid label{display:flex; flex-direction:column; gap:6px; font-size:14px; min-width:0; overflow:hidden;}
.form-grid textarea, .form-grid input, .form-grid select{
  background:var(--input-bg);
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px;
  color:var(--text);
}
.form-inline{display:flex; gap:10px; align-items:center}
.form-inline input{
  flex:1;
  background:var(--input-bg);
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px;
  color:var(--text);
}
button, .button{
  background:var(--accent-bg-hover);
  border:1px solid var(--line);
  color:var(--text);
  padding:10px 12px;
  border-radius:10px;
  cursor:pointer;
}
button:hover, .button:hover{filter:brightness(1.1); text-decoration:none}
button.danger{
  background:var(--danger-bg);
  border-color:var(--danger);
}

.button.danger{
  background:var(--danger-bg);
  border-color:var(--danger);
}
.button.ghost{
  background:transparent;
}
table{
  width:100%;
  border-collapse:collapse;
  overflow:hidden;
  border-radius:12px;
  border:1px solid var(--line);
}
thead th{
  text-align:left;
  font-size:13px;
  color:var(--muted);
  padding:10px;
  background:var(--panel-hover);
  border-bottom:1px solid var(--line);
}
tbody td{
  padding:10px;
  border-bottom:1px solid var(--line-light);
  vertical-align:top;
  font-size:14px;
}
tbody tr:hover{background:var(--accent-bg)}
.right{text-align:right}
.cards{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
}
.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:14px;
  padding:14px;
  margin-bottom:15px;
}
.card-title{color:var(--muted); font-size:14px}
.card-value{font-size:34px; font-weight:800; margin:6px 0 10px}
.card .right .button, .card div.right a.button{
  padding:6px 10px;
  font-size:13px;
  margin-bottom:10px;
}
.in{color:var(--ok); font-weight:700}
.out{color:var(--danger); font-weight:700}

/* Dashboard tiles */
.grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
  margin-top:12px;
}
@media (max-width: 1100px){
  .grid{ grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 900px){
  .grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px){
  .grid{ grid-template-columns: 1fr; }
}
.tile{
  display:block;
  padding:14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--panel);
  text-decoration:none;
  color:var(--text);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tile:hover{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  transform: translateY(-1px);
  text-decoration: none;
}
.tile-title{font-weight:650}
.tile-sub{margin-top:6px; font-size:14px}
.tile-number{font-size:32px; font-weight:800; line-height:1; margin-top:10px}

.dash-2col{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 980px){
  .dash-2col{ grid-template-columns: 1fr; }
}

/* ===== MODAL STYLES ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-overlay);
  overflow-y: auto;
  padding: 20px 0;
}

.modal-content {
  background-color: var(--modal-bg);
  margin: 50px auto;
  padding: 30px;
  border: 1px solid var(--line);
  width: 90%;
  max-width: 600px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--modal-text);
  position: relative;
}

.modal-content h3 {
  margin: 0 0 20px 0;
  padding: 0;
  color: var(--modal-text);
  font-size: 24px;
}

.close {
  color: var(--muted);
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.3s;
}

.close:hover,
.close:focus {
  color: var(--text);
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
  width: 100%;
  clear: both;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--modal-text);
  font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 14px;
  font-family: inherit;
  background-color: var(--input-bg);
  color: var(--modal-text);
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* Modal Form Submit Button */
.modal-content button[type="submit"] {
  margin-top: 10px;
  padding: 10px 24px;
  background-color: var(--ok);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.3s, filter 0.3s;
}

.modal-content button[type="submit"]:hover {
  filter: brightness(1.1);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.badge-success {
  background-color: #28a745;
  color: white;
}

.badge-danger {
  background-color: #dc3545;
  color: white;
}

/* Quote status badges */
.badge.draft { background: var(--panel-hover); color: var(--muted); }
.badge.pending-approval { background: #fff3cd; color: #856404; }
.badge.approved { background: #d4edda; color: #155724; }
.badge.sent { background: #cce5ff; color: #004085; }
.badge.accepted { background: #28a745; color: #fff; }
.badge.rejected { background: #dc3545; color: #fff; }
.badge.expired { background: #6c757d; color: #fff; }

/* Primary Button */
.btn-primary {
  padding: 10px 20px;
  background-color: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  transition: filter 0.3s;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

/* Table Button Overrides */
table button {
  padding: 6px 12px;
  margin-right: 5px;
  border: 1px solid var(--line);
  background-color: var(--panel);
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.3s;
}

table button:hover {
  background-color: var(--panel-hover);
  border-color: var(--accent);
}

/* Secondary Button */
.button.secondary {
  background: transparent;
  border: 1px solid var(--line);
}
.button.secondary:hover {
  background: var(--accent-bg);
}

/* Form styling */
.form {
  margin: 12px 0;
}
.form .row {
  margin-bottom: 12px;
}
.form .row label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--muted);
}
.form .row input,
.form .row select,
.form .row textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 14px;
}
.form .row input:focus,
.form .row select:focus,
.form .row textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Flex utilities */
.flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Note box */
.note {
  background: var(--accent-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

/* Badge variants */
.badge-info {
  background-color: #17a2b8;
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
}
.badge-warning {
  background-color: #fd7e14;
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
}

/* Label styling */
.label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* Input styling */
.input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 14px;
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 99;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-menu-btn:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
}

.mobile-brand:hover {
  text-decoration: none;
}

.mobile-brand svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

/* Mobile Close Button in Sidebar */
.mobile-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.mobile-close-btn:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.mobile-close-btn svg {
  width: 18px;
  height: 18px;
}

/* Mobile Overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-open .mobile-overlay {
  display: block;
  opacity: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .form-grid{grid-template-columns:1fr}
  .cards{grid-template-columns:1fr}
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding-top: 56px;
  }

  .sidebar-collapsed .main-content {
    margin-left: 0;
  }

  /* Hide collapse button on mobile, show close button */
  .sidebar-toggle {
    display: none;
  }

  .mobile-close-btn {
    display: flex;
  }

  .sidebar-header {
    justify-content: space-between;
  }

  /* Full width sidebar on mobile */
  .sidebar-collapsed .sidebar {
    width: var(--sidebar-width);
  }

  .sidebar-collapsed .sidebar-title,
  .sidebar-collapsed .user-name,
  .sidebar-collapsed .sidebar-nav a span,
  .sidebar-collapsed .sidebar-logout span,
  .sidebar-collapsed .sidebar-theme select {
    opacity: 1;
    width: auto;
    overflow: visible;
  }

  .sidebar-collapsed .sidebar-brand,
  .sidebar-collapsed .sidebar-user,
  .sidebar-collapsed .sidebar-nav a,
  .sidebar-collapsed .sidebar-theme,
  .sidebar-collapsed .sidebar-logout {
    justify-content: flex-start;
    padding: 10px 12px;
  }

  /* Table responsive */
  .card {
    overflow-x: auto;
  }

  table {
    min-width: 600px;
  }

  /* Filter bar mobile */
  .filter-bar,
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-form > * {
    width: 100%;
  }

  .filter-actions {
    flex-direction: column;
  }

  .filter-actions .btn-filter {
    width: 100%;
  }

  input.form-control {
    min-width: 100%;
  }

  /* Page header mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header h1 {
    font-size: 22px;
  }

  /* Flex utilities mobile */
  .flex {
    flex-wrap: wrap;
  }

  /* Modal mobile */
  .modal-content {
    width: 95%;
    margin: 20px auto;
    padding: 20px;
  }

  /* Container padding mobile */
  .container {
    padding: 12px;
  }

  /* Toast mobile */
  #toast-container {
    left: 12px;
    right: 12px;
    top: 68px;
  }

  .toast {
    max-width: 100%;
  }
}

/* Scrollbar styling for sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ===== SELECT OPTION STYLING ===== */
select option {
  background-color: var(--panel) !important;
  color: var(--text) !important;
}

/* Select dropdown styling */
select {
  background-color: var(--input-bg);
  color: var(--text);
}

/* Table input styling (discount etc) */
#itemsTable input[type="number"] {
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 4px;
  width: 70px;
  text-align: right;
}

#itemsTable input[type="number"]:focus {
  border-color: var(--accent);
  outline: none;
}

/* Select2 selected option styling */
.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: var(--accent) !important;
  color: #fff !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--accent) !important;
  color: #fff !important;
}

.select2-container--default .select2-results__option {
  color: var(--text) !important;
  background-color: var(--panel) !important;
}

.select2-dropdown {
  background-color: var(--panel) !important;
  border-color: var(--line) !important;
}

.select2-search__field {
  background-color: var(--input-bg) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

/* ===== FILES GRID ===== */
.files-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 0;
}

.file-card {
  position: relative;
  width: 100px;
  background: var(--panel-hover);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
}

.file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.file-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.file-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--panel);
}

.file-icon svg {
  width: 32px;
  height: 32px;
}

/* Extension-based colors */
.file-icon.pdf { background: #fee2e2; color: #dc2626; }
.file-icon.jpg, .file-icon.jpeg, .file-icon.png, .file-icon.gif { background: #dbeafe; color: #2563eb; }
.file-icon.doc, .file-icon.docx { background: #dbeafe; color: #1d4ed8; }
.file-icon.xls, .file-icon.xlsx { background: #dcfce7; color: #16a34a; }
.file-icon.zip, .file-icon.rar { background: #fef3c7; color: #d97706; }
.file-icon.lic, .file-icon.txt, .file-icon.csv { background: #f3f4f6; color: #6b7280; }

.file-ext {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.file-name {
  font-size: 11px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.3;
}

.file-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-radius: 50%;
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-delete-btn svg {
  width: 12px;
  height: 12px;
}

.file-card:hover .file-delete-btn {
  opacity: 1;
}

.file-delete-btn:hover {
  background: #ef4444;
  color: white;
}

.files-empty {
  width: 100%;
  text-align: center;
  padding: 32px;
  color: var(--muted);
}

.files-empty svg {
  opacity: 0.4;
  margin-bottom: 8px;
}

.files-empty p {
  margin: 0;
  font-size: 14px;
}
