/* ============================================================
   TechEx Central Operations Portal — app.css
   Design system + component styles
   Font: Inter (body), DM Sans (UI labels)
   Palette:
     Sidebar bg    : #0D1B2A (dark navy)
     Accent blue   : #2563EB
     Surface       : #FFFFFF
     Page bg       : #F4F6FA
     Border        : #E5E7EB
     Text primary  : #111827
     Text secondary: #6B7280
     Text muted    : #9CA3AF
============================================================ */

/* ── CSS Custom Properties ─────────────────────────────── */
:root {
  --sidebar-width      : 240px;
  --sidebar-bg         : #0D1B2A;
  --sidebar-text       : rgba(255,255,255,.75);
  --sidebar-text-muted : rgba(255,255,255,.4);
  --sidebar-active-bg  : rgba(37,99,235,.18);
  --sidebar-active-text: #60A5FA;
  --sidebar-hover-bg   : rgba(255,255,255,.06);
  --sidebar-border     : rgba(255,255,255,.08);

  --topbar-height      : 56px;
  --topbar-bg          : #FFFFFF;
  --topbar-border      : #E5E7EB;

  --accent             : #2563EB;
  --accent-hover       : #1D4ED8;
  --accent-light       : #EFF6FF;

  --page-bg            : #F4F6FA;
  --surface            : #FFFFFF;
  --border             : #E5E7EB;
  --border-light       : #F3F4F6;

  --text-primary       : #111827;
  --text-secondary     : #6B7280;
  --text-muted         : #9CA3AF;

  --radius-sm          : 6px;
  --radius-md          : 8px;
  --radius-lg          : 12px;
  --radius-xl          : 16px;

  --shadow-sm          : 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md          : 0 4px 12px rgba(0,0,0,.08);

  --font-body          : 'Inter', system-ui, sans-serif;
  --font-ui            : 'DM Sans', system-ui, sans-serif;

  --transition         : 150ms ease;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--page-bg);
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────── */
.ops-body {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.ops-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
  transition: transform var(--transition);
}

.ops-sidebar::-webkit-scrollbar { width: 4px; }
.ops-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

/* Logo */
.ops-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.ops-sidebar__logo-mark {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

.ops-sidebar__logo-name {
  display: block;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
  line-height: 1.2;
}

.ops-sidebar__logo-tag {
  display: block;
  font-size: 10px;
  color: var(--sidebar-text-muted);
  letter-spacing: .03em;
}

/* Nav */
.ops-sidebar__nav {
  flex: 1;
  padding: 12px 8px;
}

.ops-sidebar__section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
  padding: 8px 10px 4px;
}

.ops-sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  margin-bottom: 2px;
}

.ops-sidebar__link:hover {
  background: var(--sidebar-hover-bg);
  color: #FFFFFF;
  text-decoration: none;
}

.ops-sidebar__link.is-active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.ops-sidebar__link svg {
  flex-shrink: 0;
  opacity: .8;
}

.ops-sidebar__link.is-active svg { opacity: 1; }

.ops-sidebar__divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 8px 0;
}

/* OBLIQ button */
.ops-sidebar__obliq {
  padding: 10px 10px;
  border-top: 1px solid var(--sidebar-border);
}

.ops-sidebar__obliq-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: rgba(37,99,235,.14);
  border: 1px solid rgba(37,99,235,.3);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.ops-sidebar__obliq-btn:hover { background: rgba(37,99,235,.22); }

.ops-sidebar__obliq-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.ops-sidebar__obliq-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.ops-sidebar__obliq-text span:first-child {
  font-size: 12px;
  font-weight: 600;
  color: #60A5FA;
}

.ops-sidebar__obliq-sub {
  font-size: 10px;
  color: var(--sidebar-text-muted);
}

/* User row */
.ops-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.ops-sidebar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(37,99,235,.4);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.ops-sidebar__user-info {
  flex: 1;
  min-width: 0;
}

.ops-sidebar__user-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ops-sidebar__user-role {
  display: block;
  font-size: 10px;
  color: var(--sidebar-text-muted);
}

.ops-sidebar__logout {
  color: var(--sidebar-text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}

.ops-sidebar__logout:hover { color: #F87171; text-decoration: none; }

/* ── Main wrapper ───────────────────────────────────────── */
.ops-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────── */
.ops-topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.ops-topbar__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.ops-topbar__breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.ops-topbar__crumb {
  font-size: 13.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ops-topbar__crumb.is-current {
  color: var(--text-primary);
  font-weight: 500;
}

.ops-topbar__sep {
  color: var(--text-muted);
  font-size: 13px;
}

.ops-topbar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ops-topbar__action-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.ops-topbar__action-btn:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.ops-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: #EF4444;
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}

.ops-topbar__avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
}

.ops-topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* ── Page content ───────────────────────────────────────── */
.ops-content {
  flex: 1;
  padding: 24px;
}

/* ── Page header ────────────────────────────────────────── */
.ops-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.ops-page-header__title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.ops-page-header__sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.ops-page-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Cards ──────────────────────────────────────────────── */
.ops-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.ops-card--sm { padding: 14px 16px; }

.ops-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ops-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* ── Stat cards ─────────────────────────────────────────── */
.ops-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.ops-stat__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.ops-stat__value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.ops-stat__delta {
  font-size: 12px;
  color: var(--text-muted);
}

.ops-stat__delta.up   { color: #059669; }
.ops-stat__delta.down { color: #DC2626; }

/* ── Buttons ────────────────────────────────────────────── */
.btn-ops {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn-ops-primary {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.btn-ops-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #FFFFFF;
  text-decoration: none;
}

.btn-ops-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-ops-secondary:hover {
  background: var(--page-bg);
  color: var(--text-primary);
  text-decoration: none;
}

.btn-ops-danger {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}

.btn-ops-danger:hover {
  background: #FEE2E2;
  color: #DC2626;
  text-decoration: none;
}

.btn-ops-sm {
  font-size: 12px;
  padding: 5px 10px;
}

/* ── Badges / Pills ─────────────────────────────────────── */
.ops-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  line-height: 1;
  white-space: nowrap;
}

.ops-pill--blue    { background: #EFF6FF; color: #1D4ED8; }
.ops-pill--green   { background: #F0FDF4; color: #15803D; }
.ops-pill--yellow  { background: #FEFCE8; color: #A16207; }
.ops-pill--red     { background: #FEF2F2; color: #B91C1C; }
.ops-pill--gray    { background: #F9FAFB; color: #4B5563; border: 1px solid var(--border); }
.ops-pill--purple  { background: #F5F3FF; color: #6D28D9; }
.ops-pill--teal    { background: #F0FDFA; color: #0F766E; }
.ops-pill--orange  { background: #FFF7ED; color: #C2410C; }

/* ── Tables ─────────────────────────────────────────────── */
.ops-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.ops-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: 10px 14px;
  background: var(--page-bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ops-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.ops-table tr:last-child td { border-bottom: none; }

.ops-table tbody tr:hover { background: var(--page-bg); }

/* ── Forms ──────────────────────────────────────────────── */
.ops-form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 5px;
  display: block;
}

.ops-form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: var(--font-body);
}

.ops-form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.ops-form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Avatar ─────────────────────────────────────────────── */
.ops-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  flex-shrink: 0;
  font-family: var(--font-ui);
}

.ops-avatar--sm  { width: 28px; height: 28px; font-size: 10px; }
.ops-avatar--md  { width: 36px; height: 36px; font-size: 12px; }
.ops-avatar--lg  { width: 48px; height: 48px; font-size: 15px; }
.ops-avatar--xl  { width: 64px; height: 64px; font-size: 20px; }

/* ── Notification dropdown ──────────────────────────────── */
.ops-notif-dropdown {
  width: 340px;
  padding: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.ops-notif-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.ops-notif-dropdown__mark-all {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.ops-notif-dropdown__list {
  max-height: 320px;
  overflow-y: auto;
}

.ops-notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}

.ops-notif-item:hover { background: var(--page-bg); }
.ops-notif-item.is-unread { background: var(--accent-light); }
.ops-notif-item.is-unread:hover { background: #DBEAFE; }

.ops-notif-item__content { flex: 1; min-width: 0; }
.ops-notif-item__title { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.ops-notif-item__body  { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ops-notif-item__time  { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.ops-notif-dropdown__loading {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.ops-notif-dropdown__footer {
  display: block;
  padding: 10px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  border-top: 1px solid var(--border);
}

/* ── OBLIQ Panel ────────────────────────────────────────── */
.ops-obliq-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 390;
}

.ops-obliq-overlay.is-open { display: block; }

.ops-obliq-panel {
  position: fixed;
  right: -400px;
  top: 0;
  width: 380px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 400;
  transition: right 250ms ease;
}

.ops-obliq-panel.is-open { right: 0; }

.ops-obliq-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--sidebar-bg);
}

.ops-obliq-panel__name {
  font-size: 14px;
  font-weight: 700;
  color: #60A5FA;
  display: block;
  font-family: var(--font-ui);
  letter-spacing: .04em;
}

.ops-obliq-panel__tag {
  font-size: 10px;
  color: rgba(255,255,255,.4);
  display: block;
  margin-top: 2px;
}

.ops-obliq-panel__close {
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.ops-obliq-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ops-obliq-panel__welcome p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.ops-obliq-panel__suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ops-obliq-panel__suggestions button {
  text-align: left;
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.ops-obliq-panel__suggestions button:hover { background: var(--accent-light); color: var(--accent); }

.ops-obliq-msg { display: flex; flex-direction: column; gap: 3px; }

.ops-obliq-msg--user .ops-obliq-msg__bubble {
  background: var(--accent);
  color: #FFFFFF;
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
}

.ops-obliq-msg--bot .ops-obliq-msg__bubble {
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
}

.ops-obliq-msg__bubble {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 90%;
}

.ops-obliq-panel__input {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.ops-obliq-panel__input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  outline: none;
  font-family: var(--font-body);
}

.ops-obliq-panel__input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.ops-obliq-panel__input button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Status colors ──────────────────────────────────────── */
.status-active     { color: #059669; }
.status-inactive   { color: var(--text-muted); }
.status-pending    { color: #D97706; }
.status-approved   { color: #059669; }
.status-rejected   { color: #DC2626; }
.status-overdue    { color: #DC2626; }
.status-done       { color: #059669; }
.status-blocked    { color: #DC2626; }

/* ── Empty state ────────────────────────────────────────── */
.ops-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.ops-empty__title { font-size: 15px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.ops-empty__sub   { font-size: 13px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .ops-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .ops-sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }

  .ops-main {
    margin-left: 0;
  }

  .ops-topbar__toggle {
    display: flex;
  }

  .ops-content {
    padding: 16px;
  }

  .ops-obliq-panel {
    width: 100%;
  }
}

/* ── Utilities ──────────────────────────────────────────── */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.text-muted-sm { font-size: 12px; color: var(--text-muted); }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* Override Bootstrap for consistency */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
}

.dropdown-item { padding: 8px 14px; }
.dropdown-item:hover { background: var(--page-bg); }

.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.modal-content {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}

.modal-header {
  padding: 18px 20px;
  border-bottom-color: var(--border);
}

.modal-footer {
  padding: 14px 20px;
  border-top-color: var(--border);
}

.alert {
  border-radius: var(--radius-md);
  font-size: 13.5px;
}
