:root {
  --bg-sidebar: #161b22;
  --bg-sidebar-hover: #21262d;
  --bg-content: #f4f5f7;
  --text-sidebar: #c9d1d9;
  --text-sidebar-muted: #8b949e;
  --accent: #2f81f7;
  --card-bg: #ffffff;
  --border: #e2e5e9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-content);
  color: #1f2328;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid #2a313c;
}

.brand-icon {
  font-size: 20px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
}

.nav-group {
  margin-bottom: 6px;
}

.nav-group-title {
  padding: 12px 18px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-sidebar-muted);
  text-transform: uppercase;
}

.nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 9px 18px 9px 30px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: var(--bg-sidebar-hover);
}

.nav-link.active {
  background: var(--bg-sidebar-hover);
  border-left-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid #2a313c;
}

.logout-btn {
  width: 100%;
  background: transparent;
  border: 1px solid #2a313c;
  color: var(--text-sidebar);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.logout-btn:hover {
  background: var(--bg-sidebar-hover);
}

/* Content */
.content {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.content-header h1 {
  font-size: 22px;
  margin: 0;
}

.header-user {
  font-size: 14px;
  color: #57606a;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.card-highlight {
  border-color: var(--accent);
}

.card-label {
  font-size: 13px;
  color: #57606a;
  margin-bottom: 8px;
}

.card-value {
  font-size: 24px;
  font-weight: 700;
}

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

.placeholder-panel {
  text-align: center;
  padding: 60px 24px;
}

.placeholder-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.placeholder-group {
  color: #57606a;
  font-size: 13px;
  margin-top: -4px;
}

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-sidebar);
}

.login-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 36px 32px;
  width: 320px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.login-brand {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  color: #57606a;
  font-size: 13px;
  margin-bottom: 20px;
}

.login-error {
  background: #fdecea;
  color: #b3261e;
  border: 1px solid #f5c6c3;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form label {
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

.login-form input {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.login-form button {
  margin-top: 18px;
  padding: 10px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.login-form button:hover {
  background: #1f6feb;
}

/* Forms & tables (products, categories) */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.alert-error {
  background: #fdecea;
  color: #b3261e;
  border: 1px solid #f5c6c3;
}

.form-panel {
  margin-bottom: 24px;
}

.form-panel h2 {
  margin: 0 0 16px;
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  align-items: start;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: #57606a;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary:hover {
  background: #1f6feb;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 6px;
  color: #1f2328;
  text-decoration: none;
  font-size: 14px;
}

.thumb-preview {
  margin-top: 8px;
  max-width: 80px;
  max-height: 80px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  color: #57606a;
  font-weight: 600;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.empty-cell {
  text-align: center;
  color: #8b949e;
  padding: 24px;
}

.thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.thumb-placeholder {
  color: #8b949e;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: #dafbe1;
  color: #1a7f37;
}

.badge-muted {
  background: #eef0f2;
  color: #57606a;
}

.actions-cell {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-form {
  display: inline;
}

.link-action {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  padding: 0;
}

.link-action:hover {
  text-decoration: underline;
}

.link-danger {
  color: #b3261e;
}

/* Stock management */
.alert-success {
  background: #dafbe1;
  color: #1a7f37;
  border: 1px solid #b4f1c5;
}

.row-active {
  background: #f0f6ff;
}

.stock-import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.stock-import-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stock-import-form label {
  font-size: 13px;
  font-weight: 600;
  color: #57606a;
}

.stock-import-form textarea {
  font-family: 'Consolas', monospace;
  font-size: 13px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}

.stock-import-form input[type="file"] {
  padding: 8px 0;
}

.stock-import-form button {
  align-self: flex-start;
}

.mono-cell {
  font-family: 'Consolas', monospace;
  font-size: 12px;
}

.hint-text {
  color: #8b949e;
  font-size: 12px;
  margin-top: 8px;
}

/* Combo editor */
.combo-items-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.combo-item-row {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
}

.combo-item-row select,
.combo-item-row input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

/* Customers inline note form */
.inline-note-form {
  display: flex;
  gap: 4px;
  align-items: center;
}

.inline-note-form input {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  width: 120px;
}

.btn-small {
  padding: 3px 8px;
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn-small:hover {
  background: #1f6feb;
}
