/*
 * Dashboard UI — Libya Freelance
 * RTL-first, quiet sage palette, and responsive application shell.
 */
:root {
  --db-primary: var(--primary, #214f45);
  --db-primary-deep: var(--primary-hover, #163d34);
  --db-bg: var(--bg, #f8f9f6);
  --db-surface: var(--surface, #fff);
  --db-text: var(--text, #172d27);
  --db-muted: var(--muted, #6b7771);
  --db-line: var(--line, #e5e9e3);
  --db-sage: var(--secondary, #dce9dd);
  --db-lime: var(--lime, #e5ecc9);
  --db-gold: var(--accent, #c5a56b);
  --db-danger: var(--danger, #b54040);
  --db-radius: var(--radius, 18px);
  --db-shadow: var(--shadow, 0 8px 28px #213e3210);
}

body.dashboard-mode { background: var(--db-bg); color: var(--db-text); }
body.dashboard-mode .site-footer { display: none; }
.dashboard-mode *, .dashboard-mode *::before, .dashboard-mode *::after { box-sizing: border-box; }
.dashboard-mode a { color: inherit; }
.dashboard-mode svg { width: 20px; height: 20px; }
.dashboard-mode button, .dashboard-mode input, .dashboard-mode select, .dashboard-mode textarea { font: inherit; }

.db-layout { direction: rtl; display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: calc(100vh - 72px); gap: 0; }
.db-sidebar { background: var(--db-primary-deep); color: #f4f7ef; padding: 28px 16px 20px; display: flex; flex-direction: column; gap: 24px; }
.db-user { display: flex; align-items: center; gap: 12px; padding: 2px 8px 20px; border-bottom: 1px solid #ffffff1c; }
.db-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--db-sage); border: 2px solid #ffffff35; flex: 0 0 auto; }
.db-user strong, .db-user small { display: block; }
.db-user strong { font-size: 14px; }
.db-user small { color: #c3d1c7; font-size: 12px; margin-top: 3px; }
.db-nav { display: grid; gap: 5px; }
.db-nav a { color: #cbd9d0; display: flex; align-items: center; gap: 11px; border-radius: 12px; padding: 11px 12px; text-decoration: none; font-size: 14px; transition: .2s ease; }
.db-nav a:hover, .db-nav a.active { color: #fff; background: #ffffff15; }
.db-nav a.active { box-shadow: inset -3px 0 var(--db-gold); }
.db-nav svg, .db-nav a.active .db-nav svg { width: 20px; height: 20px; flex: 0 0 20px; stroke: currentColor; }
.db-side-note { margin-top: auto; background: #ffffff12; border: 1px solid #ffffff16; border-radius: 14px; padding: 14px; color: #d7e3da; font-size: 12px; line-height: 1.7; }
.db-main { min-width: 0; padding: 0 34px 44px; }
.db-topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--db-line); }
.db-breadcrumbs { color: var(--db-muted); font-size: 13px; }
.db-breadcrumbs strong { color: var(--db-text); }
.db-role, .db-toolbar select, .db-toolbar input { border: 1px solid var(--db-line); color: var(--db-text); background: var(--db-surface); border-radius: 10px; padding: 9px 12px; outline: 0; }
.db-role:focus, .db-toolbar select:focus, .db-toolbar input:focus, .db-form input:focus, .db-form textarea:focus, .db-form select:focus { border-color: var(--db-primary); box-shadow: 0 0 0 3px #214f4515; }
.db-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 32px 0 24px; }
.db-heading h1, .db-heading h2, .db-heading-title { font-size: clamp(24px, 3vw, 32px); margin: 0 0 6px; letter-spacing: -.5px; }
.db-heading p, .db-heading-description { margin: 0; color: var(--db-muted); font-size: 14px; }
.db-heading-action { display: flex; gap: 8px; flex-wrap: wrap; }
.db-hero { position: relative; overflow: hidden; min-height: 196px; border-radius: 22px; background: var(--db-primary); color: #fff; padding: 30px 34px; display: flex; align-items: center; margin-bottom: 24px; }
.db-hero-copy { position: relative; z-index: 1; max-width: 570px; }
.db-eyebrow { display: inline-block; color: #dce9c9; font-size: 12px; font-weight: 700; letter-spacing: .04em; margin-bottom: 9px; }
.db-hero h2 { font-size: 27px; margin: 0 0 9px; }
.db-hero p { color: #d7e5dc; margin: 0; line-height: 1.8; font-size: 14px; }
.db-hero-art { position: absolute; inset: 0 0 0 auto; width: 43%; opacity: .9; pointer-events: none; background: radial-gradient(circle at 70% 38%, #bbd09138 0 16%, transparent 16.5%), radial-gradient(circle at 84% 75%, #fff1 0 23%, transparent 23.5%); }
.db-hero-art::before, .db-hero-art::after { content: ''; position: absolute; border: 1px solid #dbe9cb45; border-radius: 50%; }
.db-hero-art::before { width: 230px; height: 230px; top: -62px; right: 40px; }
.db-hero-art::after { width: 155px; height: 155px; bottom: -68px; right: 175px; background: #b9cf9730; }
.db-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.db-stat, .db-panel, .db-order-card, .db-empty { background: var(--db-surface); border: 1px solid var(--db-line); border-radius: var(--db-radius); box-shadow: var(--db-shadow); }
.db-stat { padding: 19px; display: flex; align-items: center; gap: 13px; }
.db-stat-icon, .db-order-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--db-primary); background: var(--db-sage); flex: 0 0 auto; }
.db-stat-icon svg, .db-order-icon svg { width: 20px; height: 20px; }
.db-stat strong, .db-stat small { display: block; }
.db-stat strong { font-size: 22px; line-height: 1.2; }
.db-stat small { color: var(--db-muted); font-size: 12px; margin-top: 4px; }
.db-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.db-panel { padding: 20px; margin-bottom: 20px; }
.db-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.db-panel-head h2, .db-panel-head h3 { margin: 0; font-size: 17px; }
.db-panel-head a { color: var(--db-primary); font-size: 12px; text-decoration: none; }
.db-order { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--db-line); }
.db-order:last-child { border-bottom: 0; padding-bottom: 0; }
.db-order:first-child { padding-top: 0; }
.db-order-copy { min-width: 0; flex: 1; }
.db-order-copy strong, .db-order-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-order-copy strong { font-size: 14px; }
.db-order-copy small, .db-order-meta { color: var(--db-muted); font-size: 12px; margin-top: 4px; }
.db-order-meta { text-align: left; white-space: nowrap; }
.db-status { display: inline-flex; align-items: center; border-radius: 99px; padding: 5px 9px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.db-status[data-state="active"], .db-status[data-state="open"], .db-status[data-state="reserved"] { color: #286346; background: #dcebdc; }
.db-status[data-state="review"], .db-status[data-state="pending"] { color: #79632c; background: #f1e9ca; }
.db-status[data-state="completed"] { color: #315f62; background: #d9ece9; }
.db-status[data-state="cancelled"] { color: #934444; background: #f3dddd; }
.db-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--db-line); background: transparent; color: var(--db-text); border-radius: 10px; padding: 10px 15px; cursor: pointer; font-weight: 700; font-size: 13px; text-decoration: none; transition: .2s; }
.db-btn:hover { transform: translateY(-1px); border-color: var(--db-primary); }
.db-btn.primary { color: #fff; border-color: var(--db-primary); background: var(--db-primary); }
.db-btn.primary:hover { background: var(--db-primary-deep); }
.db-btn.small { padding: 7px 11px; font-size: 12px; }
.db-progress { height: 8px; background: var(--db-sage); border-radius: 99px; overflow: hidden; }
.db-progress-bar { height: 100%; width: var(--progress, 64%); background: var(--db-primary); border-radius: inherit; }
.db-activity { list-style: none; margin: 0; padding: 0; }
.db-activity li { position: relative; padding: 0 23px 17px 0; color: var(--db-muted); font-size: 12px; line-height: 1.65; }
.db-activity li:last-child { padding-bottom: 0; }
.db-activity li::before { content: ''; position: absolute; right: 2px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--db-gold); box-shadow: 0 0 0 4px #c5a56b25; }
.db-activity li::after { content: ''; position: absolute; right: 5px; top: 15px; bottom: 0; border-right: 1px dashed var(--db-line); }
.db-activity li:last-child::after { display: none; }
.db-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.db-toolbar input { min-width: 210px; flex: 1; }
.db-tabs { display: flex; align-items: center; gap: 5px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 3px; }
.db-tabs button { border: 0; background: transparent; color: var(--db-muted); padding: 9px 13px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.db-tabs button.active { color: var(--db-primary); background: var(--db-sage); font-weight: 700; }
.db-order-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.db-order-card { padding: 18px; }
.db-order-card .db-order { border-bottom: 0; padding: 0; margin-bottom: 16px; }
.db-order-card .db-progress { margin: 14px 0 8px; }
.db-empty { text-align: center; padding: 42px 22px; color: var(--db-muted); }
.db-empty strong { display: block; color: var(--db-text); margin-bottom: 6px; }
.db-service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.db-service { overflow: hidden; background: var(--db-surface); border: 1px solid var(--db-line); border-radius: var(--db-radius); box-shadow: var(--db-shadow); }
.db-service img { display: block; width: 100%; height: 142px; object-fit: cover; }
.db-service-body { padding: 15px; }
.db-service-body h3 { font-size: 15px; margin: 0 0 6px; }
.db-service-body p { color: var(--db-muted); font-size: 12px; margin: 0; line-height: 1.7; }
.db-wallet { background: var(--db-primary-deep); color: #fff; border-radius: var(--db-radius); padding: 22px; margin-bottom: 20px; }
.db-wallet small { color: #c3d6c9; }
.db-wallet-number { font-size: 28px; letter-spacing: 1px; font-weight: 700; margin: 22px 0; }
.db-table-wrapper { overflow-x: auto; border: 1px solid var(--db-line); border-radius: var(--db-radius); background: var(--db-surface); }
.db-table-wrapper table { width: 100%; min-width: 620px; border-collapse: collapse; text-align: right; font-size: 13px; }
.db-table-wrapper th, .db-table-wrapper td { padding: 14px 17px; border-bottom: 1px solid var(--db-line); }
.db-table-wrapper th { color: var(--db-muted); background: #f4f7f2; font-size: 12px; font-weight: 700; }
.db-table-wrapper tr:last-child td { border-bottom: 0; }
.db-chat { display: grid; grid-template-columns: 250px minmax(0, 1fr); direction: ltr; min-height: 600px; overflow: hidden; border: 1px solid var(--db-line); border-radius: var(--db-radius); background: var(--db-surface); box-shadow: var(--db-shadow); }
.db-thread-list { direction: rtl; border-left: 1px solid var(--db-line); overflow-y: auto; }
.db-thread { display: block; padding: 15px; border-bottom: 1px solid var(--db-line); text-decoration: none; }
.db-thread.active, .db-thread:hover { background: var(--db-sage); }
.db-thread strong, .db-thread small { display: block; }
.db-thread strong { font-size: 13px; }
.db-thread small { color: var(--db-muted); font-size: 11px; margin-top: 5px; }
.db-chat-main { direction: rtl; min-width: 0; display: flex; flex-direction: column; }
.db-chat-head { padding: 17px 20px; border-bottom: 1px solid var(--db-line); }
.db-chat-head strong { font-size: 15px; }
.db-chat-body { flex: 1; padding: 22px; overflow-y: auto; background: #fbfcfa; display: flex; flex-direction: column; gap: 10px; }
.db-bubble { max-width: min(78%, 470px); padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: #e8eee7; color: var(--db-text); font-size: 13px; line-height: 1.7; align-self: flex-start; }
.db-bubble.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; color: #fff; background: var(--db-primary); }
.db-chat-form { display: flex; align-items: center; gap: 8px; padding: 13px; border-top: 1px solid var(--db-line); }
.db-chat-form input { flex: 1; min-width: 0; border: 1px solid var(--db-line); border-radius: 10px; padding: 10px 12px; outline: 0; }
.db-attachment { display: grid; place-items: center; width: 38px; height: 38px; border: 0; background: var(--db-sage); color: var(--db-primary); border-radius: 10px; cursor: pointer; }
.db-attachment svg { width: 20px; height: 20px; }
.db-chat-info { color: var(--db-muted); font-size: 12px; line-height: 1.8; }
.db-form { max-width: 780px; }
.db-form label { display: grid; gap: 7px; color: var(--db-text); font-size: 13px; font-weight: 700; }
.db-form input, .db-form textarea, .db-form select { width: 100%; border: 1px solid var(--db-line); border-radius: 10px; background: var(--db-surface); color: var(--db-text); padding: 11px 12px; outline: 0; resize: vertical; }
.db-form textarea { min-height: 125px; }
.db-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.db-profile-head { display: flex; align-items: center; gap: 18px; padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--db-line); }
.db-profile-head .db-avatar { width: 76px; height: 76px; }
.db-profile-head h2 { margin: 0 0 5px; font-size: 22px; }
.db-profile-head p { color: var(--db-muted); margin: 0; font-size: 13px; }
.db-portfolio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.db-portfolio img { width: 100%; aspect-ratio: 1.25; display: block; object-fit: cover; border-radius: 12px; }
.db-notification { display: flex; align-items: flex-start; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--db-line); }
.db-notification:last-child { border-bottom: 0; }
.db-notification strong, .db-notification small { display: block; }
.db-notification strong { font-size: 13px; }
.db-notification small { color: var(--db-muted); font-size: 11px; margin-top: 4px; }
.db-demo-note { color: var(--db-muted); background: var(--db-lime); border: 1px solid #ced9ac; border-radius: 12px; padding: 12px 14px; font-size: 12px; line-height: 1.7; }

@media (max-width: 1000px) {
  .db-layout { display: block; }
  .db-sidebar { padding: 12px 18px; display: block; }
  .db-user { display: inline-flex; border: 0; padding: 0; margin-left: 18px; vertical-align: middle; }
  .db-side-note { display: none; }
  .db-nav { display: inline-flex; vertical-align: middle; gap: 4px; overflow-x: auto; max-width: calc(100% - 170px); }
  .db-nav a { padding: 9px 10px; white-space: nowrap; }
  .db-nav a.active { box-shadow: inset 0 -3px var(--db-gold); }
  .db-nav a span { display: none; }
  .db-main { padding: 0 22px 36px; }
  .db-columns { grid-template-columns: 1fr; }
  .db-service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .db-main { padding: 0 14px 28px; }
  .db-topbar { min-height: 62px; }
  .db-heading { display: block; padding: 24px 0 18px; }
  .db-heading-action { margin-top: 15px; }
  .db-hero { padding: 24px 21px; min-height: 185px; }
  .db-hero h2 { font-size: 23px; }
  .db-hero-art { width: 55%; opacity: .6; }
  .db-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .db-stat { padding: 14px 12px; }
  .db-stat-icon { width: 36px; height: 36px; }
  .db-stat strong { font-size: 19px; }
  .db-columns { gap: 0; }
  .db-order-grid, .db-form-grid { grid-template-columns: 1fr; }
  .db-order { align-items: flex-start; flex-wrap: wrap; }
  .db-order-meta { margin-right: 54px; width: calc(100% - 54px); text-align: right; }
  .db-service-grid { grid-template-columns: 1fr; }
  .db-profile-head { align-items: flex-start; }
  .db-portfolio { grid-template-columns: repeat(2, 1fr); }
  .db-chat { grid-template-columns: 1fr; min-height: 0; }
  .db-thread-list { display: flex; direction: rtl; overflow-x: auto; overflow-y: hidden; border-left: 0; border-bottom: 1px solid var(--db-line); }
  .db-thread { min-width: 145px; border-bottom: 0; border-left: 1px solid var(--db-line); }
  .db-chat-main { min-height: 460px; }
  .db-chat-body { padding: 16px; }
  .db-bubble { max-width: 88%; }
}
