/* Surrati back office — plain CSS, no build step. */
:root {
  --gold: #b8945a;
  --gold-dark: #9c7b45;
  --black: #1a1a1a;
  --sidebar: #141414;
  --bg: #f5f4f1;
  --card: #ffffff;
  --border: #e6e3dd;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --red: #c0392b;
  --green: #1e8449;
  --blue: #2563eb;
  --yellow: #b7791f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
img { max-width: 100%; }

/* ---- layout ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px;
  background: var(--sidebar);
  color: #ddd;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { padding: 22px 20px; border-bottom: 1px solid #2a2a2a; }
.sidebar .brand strong { display: block; color: #fff; letter-spacing: .12em; font-size: 15px; }
.sidebar .brand span { color: var(--gold); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; }
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 8px; color: #cfcfcf; margin-bottom: 2px;
}
.sidebar nav a:hover { background: #222; text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--gold); color: #fff; }
.sidebar nav .section { color: #777; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; padding: 14px 12px 6px; }
.sidebar .count { background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; }
.sidebar .user { padding: 14px 20px; border-top: 1px solid #2a2a2a; font-size: 13px; }
.sidebar .user button { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 0; font: inherit; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- cards & grids ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1180px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat .value small { font-size: 13px; color: var(--muted); font-weight: 400; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 500; background: #faf9f7; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbf9; }
td.num, th.num { text-align: right; white-space: nowrap; }
.thumb { width: 42px; height: 42px; object-fit: contain; background: #f1f0ed; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---- badges ---- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; background: #eee; color: #444; white-space: nowrap; }
.badge.pending, .badge.new, .badge.warning { background: #fdf3e1; color: var(--yellow); }
.badge.confirmed, .badge.processing, .badge.read, .badge.info { background: #e8effd; color: var(--blue); }
.badge.shipped { background: #ede7fb; color: #6d28d9; }
.badge.delivered, .badge.paid, .badge.success, .badge.replied { background: #e4f4ea; color: var(--green); }
.badge.cancelled, .badge.refunded, .badge.failed, .badge.danger { background: #fbe7e5; color: var(--red); }

/* ---- forms ---- */
label { display: block; font-weight: 500; margin-bottom: 5px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid #d6d2ca; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 148, 90, .15); }
textarea { min-height: 110px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 8px; }
.check input { width: 16px; height: 16px; accent-color: var(--gold); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 150px; }
.checklist { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.lang-tag { font-size: 11px; color: var(--muted); font-weight: 400; }
[dir=rtl] { text-align: right; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 8px; border: 1px solid transparent;
  background: var(--black); color: #fff; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn.gold { background: var(--gold); }
.btn.light { background: #fff; color: var(--text); border-color: #d6d2ca; }
.btn.danger { background: #fff; color: var(--red); border-color: #efc4bf; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.link { background: none; color: var(--gold-dark); padding: 0; border: 0; }
form.inline { display: inline; }

/* ---- alerts ---- */
.alert { padding: 11px 15px; border-radius: 8px; margin-bottom: 18px; }
.alert.success { background: #e4f4ea; color: #145a32; border: 1px solid #bfe3cc; }
.alert.error { background: #fbe7e5; color: #922b21; border: 1px solid #f1c2bd; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---- pagination ---- */
.pagination { display: flex; gap: 4px; padding: 14px 18px; border-top: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 5px 11px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.pagination .current { background: var(--gold); border-color: var(--gold); color: #fff; }
.pagination .disabled { color: #bbb; }
.pagination .info { border: 0; background: none; color: var(--muted); margin-left: auto; }

/* ---- misc ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }
.images { display: flex; flex-wrap: wrap; gap: 10px; }
.images .img { position: relative; width: 96px; }
.images img { width: 96px; height: 96px; object-fit: contain; background: #f1f0ed; border-radius: 8px; border: 1px solid var(--border); }
.message-body { white-space: pre-wrap; background: #faf9f7; border-radius: 8px; padding: 14px; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--sidebar); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 32px; }
.login-card .brand { text-align: center; margin-bottom: 24px; }
.login-card .brand strong { display: block; letter-spacing: .15em; font-size: 18px; }
.login-card .brand span { color: var(--gold); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar nav .section { display: none; }
  .main { padding: 18px 16px 40px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2, .cols { grid-template-columns: 1fr; }
}

/* ---- new order notifications ---- */
.alerts-controls { padding: 10px 20px 0; display: flex; flex-direction: column; gap: 4px; }
.alerts-controls button { background: none; border: 0; color: #aaa; font: inherit; font-size: 12px; text-align: left; cursor: pointer; padding: 2px 0; }
.alerts-controls button:hover:not(:disabled) { color: #fff; }
.alerts-controls button:disabled { cursor: default; }
.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast {
  position: relative; display: block; background: #1a1a1a; color: #eee; border-left: 4px solid var(--gold);
  border-radius: 10px; padding: 12px 34px 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: toast-in .25s ease-out;
}
.toast:hover { text-decoration: none; background: #222; }
.toast-title { color: #fff; font-weight: 600; margin-bottom: 2px; }
.toast-meta { color: var(--gold); font-size: 12px; margin-top: 2px; }
.toast-close { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: #888; font-size: 18px; cursor: pointer; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.new-orders-banner { display: none; margin-bottom: 18px; }
.new-orders-banner.visible { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---- order detail ---- */
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.kv dt { white-space: nowrap; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.warn-text { color: var(--red); font-weight: 500; }
.address-block { line-height: 1.6; }
.copy-btn { font-size: 12px; }
.stock-ok { color: var(--green); }
.stock-low { color: var(--yellow); }
.stock-out { color: var(--red); }
.print-only { display: none; }

@media print {
  .sidebar, .no-print, .toast-stack, .alert, .actions, form { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 12px; }
  .main { padding: 0; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .cols { grid-template-columns: 1fr 1fr; }
  a { color: inherit; }
}
