/* VolcAIno components — extracted verbatim from styles.css. Depends on tokens.css. All RTL (html dir="rtl"). */

/* Layout */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background: var(--bg);
}
.main {
  flex: 1 1 auto;
  padding: 20px 24px 28px 24px;
  min-width: 0;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  flex: 0 0 220px;
  width: 220px;
  position: sticky;
  top: 12px;
  align-self: flex-start;
  height: calc(100vh - 24px);
  margin: 12px 12px 12px 0;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 18px 12px 12px 12px;
  display: flex;
  flex-direction: column;
}
.sidebar__brand {
  padding: 4px 8px 16px 8px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 12px;
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
}
/* Brand logo: anchor-right (RTL natural), capped height for the sidebar
   chrome. `object-fit: contain` keeps the wordmark crisp on hi-DPI and
   never letterboxes against the transparent PNG background. */
.sidebar__brand-logo {
  display: block;
  height: 34px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  object-position: right center;
  margin: 2px 0 4px;
}
/* Legacy h1 + dot kept as a fallback for any screen that hasn't migrated
   to the <img> yet — same visual rhythm. */
.sidebar__brand h1 { font-size: 17px; font-weight: 800; margin: 0; color: var(--text); letter-spacing: -0.01em; display: flex; gap: 8px; align-items: center; justify-content: flex-start; flex-direction: row-reverse;}
.sidebar__brand h1 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary-grad); display: inline-block; box-shadow: 0 0 0 3px var(--primary-50); }
.sidebar__brand p { margin: 4px 0 0; color: var(--text-3); font-size: 11px; }
.sidebar__nav { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.sidebar__nav::-webkit-scrollbar { width: 4px;}
.sidebar__nav::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: 2px;}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: right;
  font-weight: 500;
  transition: background 120ms;
  flex-direction: row-reverse;
  justify-content: flex-end;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--primary-grad);
  color: white;
  box-shadow: 0 6px 18px -6px var(--primary-500);
  font-weight: 600;
}
.nav-item.active .nav-icon { color: white; }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center;}
.nav-item .badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  min-width: 20px;
  text-align: center;
}
.nav-item.active .badge { background: rgba(255,255,255,0.25); }

.sidebar__user {
  border-top: 1px solid var(--stroke);
  padding-top: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row-reverse;
  text-align: right;
}
.sidebar__user .avatar { width: 30px; height: 30px; font-size: 11px;}
.sidebar__user-info b { font-size: 12px;}
.sidebar__user-info span { font-size: 10px;}
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-grad); color: white; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px;}
.avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.avatar--lg { width: 56px; height: 56px; font-size: 18px;}
.sidebar__user-info { flex: 1; min-width: 0; }
.sidebar__user-info b { display: block; font-size: 14px; color: var(--text); font-weight: 600;}
.sidebar__user-info span { font-size: 12px; color: var(--text-3);}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.topbar h2 {
  font-size: var(--fs-7);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
}
.topbar h2 .sub { color: var(--text-3); font-weight: 400; font-size: var(--fs-5); margin-right: 8px; }
/* The spacer pushes itself to the end of the flex line via `order:99`, so
   actions sit immediately next to the title rather than at the opposite
   edge. In an RTL document this puts: [title][actions]——————[spacer]
   → both title and date/dept filters anchor on the right side. */
.topbar__spacer  { flex: 1; order: 99; }
.topbar__actions { display: flex; gap: 10px; align-items: center; flex-direction: row-reverse;}


.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
  white-space: nowrap;
  flex-direction: row-reverse;
}
.btn:hover { border-color: var(--stroke-strong); background: var(--surface-2); }
.btn--primary {
  background: var(--primary-grad);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px -4px var(--primary-500);
  font-weight: 600;
}
.btn--primary:hover { filter: brightness(1.05); background: var(--primary-grad); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger); border-color: transparent; color: white;}
.btn--danger:hover { background: #c12d4d;}
.btn--sm { padding: 6px 12px; font-size: 13px; border-radius: var(--r-sm);}
.btn--icon { width: 38px; height: 38px; padding: 0; justify-content: center; }
.btn--icon.btn--sm { width: 30px; height: 30px;}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: var(--pad);
}
.card__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card__head h3 { margin: 0; font-size: var(--fs-5); font-weight: 600; color: var(--text); letter-spacing: -0.01em;}
.card__head p { margin: 4px 0 0; color: var(--text-3); font-size: 13px;}
.card__head .spacer { flex: 1; }

/* Stats grid (dashboard) */
.stat {
  position: relative;
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.stat__label { font-size: 13px; color: var(--text-3); font-weight: 500;}
.stat__value { font-size: 30px; font-weight: 700; color: var(--text); margin-top: 10px; letter-spacing: -0.02em; line-height: 1.4; padding-top: 2px;}
.stat__delta { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 600; margin-top: 12px; padding: 3px 8px; border-radius: var(--r-pill); flex-direction: row-reverse;}
.stat__delta.up { background: var(--success-bg); color: var(--success);}
.stat__delta.down { background: var(--danger-bg); color: var(--danger);}
.stat__icon { position: absolute; top: 18px; inset-inline-end: 18px; width: 38px; height: 38px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; }
.stat { text-align: right; }
.stat__label { display: block; padding-inline-end: 50px; }

/* Chips & tags */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--stroke);flex-direction: row-reverse;}
.chip--success { background: var(--success-bg); color: var(--success); border-color: transparent;}
.chip--danger { background: var(--danger-bg); color: var(--danger); border-color: transparent;}
.chip--warn { background: var(--warn-bg); color: var(--warn); border-color: transparent;}
.chip--info { background: var(--info-bg); color: var(--info); border-color: transparent;}
.chip--primary { background: var(--primary-50); color: var(--primary-700); border-color: transparent;}
.chip--solid { background: var(--text); color: white; border-color: transparent;}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;}

/* Search input */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 9px 14px;
  font-size: 14px;
  color: var(--text-2);
  min-width: 280px;
  flex-direction: row-reverse;
}
.search input { border: 0; background: transparent; outline: none; flex: 1; font-size: 14px; color: var(--text); text-align: right; }
.search input::placeholder { color: var(--text-4); }

/* Tables */
.table { width: 100%; border-collapse: collapse; table-layout: auto; }
.table th, .table td {
  padding: 14px 16px;
  text-align: right;
  font-size: 14px;
  border-bottom: 1px solid var(--stroke);
  vertical-align: middle;
  white-space: nowrap;       /* prevents wrap that visually breaks alignment */
}
/* Long ULID ids would otherwise dominate the layout and squeeze every
   other column — clip to one line with an ellipsis and keep things
   honest. The full id is still visible on hover via the cell's title. */
.table td.num,
.table td:first-child {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table th {
  font-weight: 500;
  color: var(--text-3);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}
.table tbody tr { cursor: pointer; transition: background 80ms;}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--primary-50);}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2);}
.field input, .field select, .field textarea {
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke);
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 120ms;
  text-align: right;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary-400); box-shadow: 0 0 0 3px var(--primary-50);}

