/* ═══════════════════════════════════════════════════
   Rocabella V2 Design System
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sidebar-w: 228px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active-bg: #2563eb;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #2563eb;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --green-border: #bbf7d0;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --r: 10px;
  --r-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ──────────────────────────────────────── */
.rb-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.rb-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.rb-brand-logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rb-brand-icon {
  width: 30px; height: 30px;
  background: var(--blue);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
}
.rb-brand-sub {
  font-size: .68rem;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 4px;
}

.rb-nav { flex: 1; padding: 10px 10px; overflow-y: auto; }
.rb-nav-section {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.25);
  font-weight: 600;
  padding: 14px 10px 5px;
}
.rb-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .86rem;
  font-weight: 500;
  transition: all .12s;
  margin-bottom: 2px;
  position: relative;
}
.rb-nav-link:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,.9);
}
.rb-nav-link.active {
  background: var(--sidebar-active-bg);
  color: #fff;
}
.rb-nav-link i { font-size: 1rem; flex-shrink: 0; }
.rb-nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.rb-user {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.rb-user-avatar {
  width: 32px; height: 32px;
  background: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .8rem;
  flex-shrink: 0;
}
.rb-user-name { color: rgba(255,255,255,.8); font-size: .82rem; font-weight: 500; }
.rb-user-logout {
  margin-left: auto;
  color: rgba(255,255,255,.3);
  font-size: .9rem;
  text-decoration: none;
  transition: color .12s;
}
.rb-user-logout:hover { color: rgba(255,255,255,.7); }

/* ── Layout ───────────────────────────────────────── */
.rb-layout { margin-left: var(--sidebar-w); min-height: 100vh; }
.rb-main { padding: 28px 32px; max-width: 940px; }

/* ── Alerts ───────────────────────────────────────── */
.rb-alert {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rb-alert-success { background: var(--green-bg); border: 1px solid var(--green-border); color: #166534; }
.rb-alert-danger  { background: var(--red-bg); border: 1px solid #fecaca; color: #991b1b; }
.rb-alert-info    { background: var(--blue-bg); border: 1px solid var(--blue-border); color: #1e40af; }
.rb-alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ── Cards ────────────────────────────────────────── */
.rb-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.rb-card-header {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
}

/* ── Header OC ────────────────────────────────────── */
.rb-oc-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  border-radius: var(--r);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.rb-oc-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(37,99,235,.15);
  border-radius: 50%;
}
.rb-oc-supplier {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.rb-oc-sub {
  color: rgba(255,255,255,.6);
  font-size: .9rem;
  margin-bottom: 14px;
}
.rb-oc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.rb-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
}
.rb-chip-blue   { background: rgba(37,99,235,.2);  color: #93c5fd; border: 1px solid rgba(37,99,235,.3); }
.rb-chip-green  { background: rgba(22,163,74,.2);  color: #86efac; border: 1px solid rgba(22,163,74,.3); }
.rb-chip-red    { background: rgba(220,38,38,.2);  color: #fca5a5; border: 1px solid rgba(220,38,38,.3); }
.rb-chip-white  { background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.15); }
.rb-chip-amber  { background: rgba(217,119,6,.2);  color: #fcd34d; border: 1px solid rgba(217,119,6,.3); }

.rb-oc-actions { margin-left: auto; }

/* ── Timeline ─────────────────────────────────────── */
.rb-timeline { padding: 4px 0 8px; }

.rb-tl-section {
  padding: 14px 22px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-3);
}
.rb-tl-section:first-child { border-top: none; }
.rb-tl-section-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
}
.tl-sec-done   { background: #dcfce7; color: var(--green); }
.tl-sec-active { background: #dbeafe; color: var(--blue); }
.tl-sec-pending{ background: #f1f5f9; color: var(--text-3); }
.rb-tl-section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.rb-tl-section-status {
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.tl-status-done    { background: #dcfce7; color: var(--green); }
.tl-status-active  { background: #dbeafe; color: var(--blue); }
.tl-status-pending { background: #f1f5f9; color: var(--text-3); }

.rb-step {
  display: flex;
  align-items: center;
  padding: 10px 22px 10px 52px;
  gap: 14px;
  position: relative;
  transition: background .1s;
}
.rb-step:hover { background: #fafafa; }

.rb-step-connector {
  position: absolute;
  left: 33px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.rb-step:last-of-type .rb-step-connector { display: none; }

.rb-step-dot {
  position: absolute;
  left: 24px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700;
  z-index: 1;
  border: 2px solid transparent;
  flex-shrink: 0;
}
.rb-step-done    .rb-step-dot { background: var(--green);  color: #fff; border-color: var(--green); }
.rb-step-active  .rb-step-dot { background: #fff; color: var(--blue); border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.rb-step-pending .rb-step-dot { background: #fff; color: var(--text-3); border-color: #cbd5e1; }

.rb-step-label {
  flex: 0 0 210px;
  font-size: .86rem;
  font-weight: 500;
}
.rb-step-done    .rb-step-label { color: var(--text); }
.rb-step-active  .rb-step-label { color: var(--text); font-weight: 600; }
.rb-step-pending .rb-step-label { color: var(--text-3); }

.rb-step-value {
  font-size: .86rem;
  color: var(--green);
  font-weight: 600;
}

/* ── Inputs ───────────────────────────────────────── */
.rb-input-date, .rb-input-text {
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: .84rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.rb-input-date:focus, .rb-input-text:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.rb-input-date { width: 148px; }
.rb-input-text { width: 150px; }
.rb-input-date.filled {
  border-color: #86efac;
  color: var(--green);
  font-weight: 600;
}

/* ── Buttons ──────────────────────────────────────── */
.rb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--r-sm);
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  line-height: 1;
}
.rb-btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.rb-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.rb-btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.rb-btn-success:hover { background: #15803d; color: #fff; }
.rb-btn-outline { background: #fff; color: var(--text-2); border-color: var(--border); }
.rb-btn-outline:hover { background: #f8fafc; color: var(--text); }
.rb-btn-warning { background: var(--amber); color: #fff; border-color: var(--amber); }
.rb-btn-warning:hover { background: #b45309; color: #fff; }
.rb-btn-danger  { background: var(--red); color: #fff; border-color: var(--red); }
.rb-btn-sm { padding: 5px 12px; font-size: .78rem; }
.rb-btn-xs { padding: 4px 10px; font-size: .74rem; }

/* ── Save button (inline – V2) ────────────────────── */
.rb-save-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: var(--r-sm);
  background: var(--blue);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.rb-save-field:hover { background: #1d4ed8; }
.rb-save-field.saving { background: #64748b; pointer-events: none; }
.rb-save-field.saved  { background: var(--green); }
.rb-save-field.error  { background: var(--red); }

/* ── Log history ──────────────────────────────────── */
.rb-log { padding: 10px 22px; border-bottom: 1px solid var(--border); font-size: .8rem; }
.rb-log:last-child { border-bottom: none; }
.rb-log-time { color: var(--text-3); margin-right: 6px; font-variant-numeric: tabular-nums; }
.rb-log-user {
  background: #e2e8f0;
  color: #475569;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 600;
  margin-right: 6px;
}

/* ── Compare bar ──────────────────────────────────── */
.rb-compare {
  background: #1e293b;
  color: rgba(255,255,255,.7);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .8rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.rb-compare a { color: rgba(255,255,255,.5); text-decoration: none; transition: color .12s; }
.rb-compare a:hover { color: #fff; }
.rb-compare a.here { color: #fff; font-weight: 700; border-bottom: 2px solid var(--blue); padding-bottom: 2px; }
.rb-compare-sep { color: rgba(255,255,255,.2); }

/* ── Check animation ──────────────────────────────── */
@keyframes pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.pop { animation: pop .3s ease; }

/* ── Misc ─────────────────────────────────────────── */
.rb-back { color: var(--text-3); text-decoration: none; font-size: .82rem; display: inline-flex; align-items: center; gap: 5px; margin-bottom: 16px; }
.rb-back:hover { color: var(--text-2); }
