:root {
  --rf-orange: #ED7900;
  --rf-orange-dark: #c46100;
  --rf-orange-tint: #fff3e6;
  --rf-black: #16181A;
  --rf-black-soft: #23262a;
  --rf-ink: #2b2b2b;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
body { background: #f2f3f5; color: var(--rf-ink); font-size: 14px; }

/* Layout shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--rf-black); color: #fff;
  position: fixed; top: 0; bottom: 0; left: 0; padding: 0 0 1rem; overflow-y: auto;
}
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.brand { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1rem .9rem .9rem; background: var(--rf-black); border-bottom: 2px solid var(--rf-orange); }
.brand-logo { width: 100%; max-width: 168px; height: auto; display: block; }
.brand-mark { background: var(--rf-orange); color: #fff; font-weight: 800; border-radius: 8px; padding: .15rem .5rem; letter-spacing: .5px; }
.brand-text { font-weight: 600; font-size: .9rem; letter-spacing: 1px; text-transform: uppercase; color: var(--rf-orange); }

.sidebar .nav { padding: .6rem .5rem; gap: 2px; }
.sidebar .nav-link { color: rgba(255,255,255,.82); border-radius: 8px; padding: .52rem .8rem; display: flex; align-items: center; gap: .6rem; font-size: .92rem; }
.sidebar .nav-link i { width: 18px; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar .nav-link.active { background: var(--rf-orange); color: #fff; font-weight: 600; }
.sidebar .nav-sep { color: rgba(255,255,255,.40); font-size: .68rem; text-transform: uppercase; letter-spacing: .8px; padding: .8rem .9rem .2rem; }

/* Topbar */
.topbar { background: #fff; height: 58px; display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; border-bottom: 1px solid #e4e4e7; position: sticky; top: 0; z-index: 20; }
.topbar-title { font-weight: 600; font-size: 1.05rem; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.user-meta { text-align: right; line-height: 1.1; }
.user-name { display: block; font-weight: 600; font-size: .85rem; }
.badge.role-admin { background: var(--rf-orange); color: #fff; }
.badge.role-manager { background: var(--rf-black-soft); }
.badge.role-viewer { background: #475569; }

.content { padding: 1.25rem 1.5rem; }

/* Cards / tables */
.card { border: 1px solid #e6e6e9; border-radius: 12px; }
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.4rem; margin: 0; font-weight: 700; }
.page-head .spacer { flex: 1; }

.table { font-size: 13.3px; }
.table thead th { background: var(--rf-orange-tint); color: var(--rf-orange-dark); font-weight: 600; border-bottom: 2px solid #f3d9bd; white-space: nowrap; }
.table-hover tbody tr:hover { background: #fff8f0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-archived { opacity: .5; }

.btn-rf { background: var(--rf-orange); color: #fff; }
.btn-rf:hover { background: var(--rf-orange-dark); color: #fff; }
.text-rf { color: var(--rf-orange-dark); }

/* Stat cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card { background: #fff; border: 1px solid #e6e6e9; border-radius: 12px; padding: .9rem 1.1rem; }
.stat-card .label { color: #6b7280; font-size: .74rem; text-transform: uppercase; letter-spacing: .4px; }
.stat-card .value { font-size: 1.7rem; font-weight: 700; color: var(--rf-orange-dark); line-height: 1.2; }
.stat-card.warn .value { color: #b45309; }
.stat-card.danger .value { color: #b00020; }
.stat-card.ok .value { color: #15803d; }

/* Status pill (clickable inline) */
.status-pill { cursor: pointer; border: none; font-weight: 600; font-size: .76rem; padding: .28rem .6rem; border-radius: 20px; white-space: nowrap; }
.status-pill.locked { cursor: default; }
.urg-overdue { background: #FFC7CE; color: #842029; }
.urg-action_overdue { background: #ffe0b2; color: #7c4a00; }
.urg-arriving_soon { background: #FFEB9C; color: #7c5a00; }
.urg-pending { background: #e2e3e5; color: #41464b; }
.urg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot-overdue { background: #b00020; }
.dot-action_overdue { background: #d97706; }
.dot-arriving_soon { background: #d4a700; }
.dot-pending { background: #8a8f98; }
.dot-ok { background: #cbd5e1; }

tr.row-overdue td { box-shadow: inset 3px 0 0 #b00020; }
tr.row-arriving_soon td { box-shadow: inset 3px 0 0 #d4a700; }
tr.row-action_overdue td { box-shadow: inset 3px 0 0 #d97706; }
tr.row-pending td { box-shadow: inset 3px 0 0 #8a8f98; }

.attention-panel { border-left: 4px solid #b00020; }
.checklist-ok { color: #15803d; }
.checklist-missing { color: #b00020; }

.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { padding: .5rem 0 .5rem .9rem; border-left: 2px solid #f0ddc6; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .8rem; width: 8px; height: 8px; border-radius: 50%; background: var(--rf-orange); }
.timeline .meta { color: #6b7280; font-size: .76rem; }

/* Toasts */
.toast-wrap { position: fixed; top: 70px; right: 20px; z-index: 1080; display: flex; flex-direction: column; gap: .5rem; }
.rf-toast { background: #fff; border-left: 4px solid var(--rf-orange); box-shadow: 0 6px 20px rgba(0,0,0,.15); border-radius: 8px; padding: .7rem 1rem; min-width: 260px; animation: slidein .25s ease; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(120deg, var(--rf-black) 0%, var(--rf-black) 34%, var(--rf-orange) 100%); }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.35); padding: 2.2rem; width: 100%; max-width: 380px; border-top: 4px solid var(--rf-orange); }
.login-card .brand-mark { font-size: 1.4rem; }
.login-logo { width: 100%; max-width: 240px; height: auto; border-radius: 10px; }

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; z-index: 1050; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
}
