/* PRO Management Services — black & gold */
:root {
  --black: #141414; --black2: #262626; --gold: #C9A227; --gold-dark: #A8841A; --gold-light: #F6EDCF;
  --ink: #1E2330; --muted: #6B7280; --surface: #F1F2F4; --line: #E6E8EC; --white: #fff;
  --red: #E5484D; --amber: #E2A400; --green: #22A06B; --blue: #2563EB; --purple: #7C3AED; --navy: #1F2A44;
  --red-bg: #FDECEE; --amber-bg: #FFF4DE; --green-bg: #E7F5EC; --gray-bg: #F0F0F2; --blue-bg: #E8EFFE;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--surface); font-size: 14.5px; line-height: 1.5; }
a { color: var(--gold-dark); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: embed; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }

/* ---------------- layout ---------------- */
#app { min-height: 100%; display: flex; flex-direction: column; }
.topbar { background: linear-gradient(90deg, #0E0E0E, #1C1C1C); border-bottom: 2px solid var(--gold); color: #fff;
  display: flex; align-items: center; gap: 14px; padding: 10px 18px; min-height: 72px; position: sticky; top: 0; z-index: 30; }
.topbar .logo { height: 50px; max-width: 130px; object-fit: contain; }
.topbar .title { color: var(--gold); font-size: 21px; font-weight: 800; line-height: 1.15; }
.topbar .sub { color: #D9D9D9; font-size: 12.5px; }
.topbar .clock { text-align: center; font-size: 13px; }
.topbar .clock .t { color: #bdbdbd; font-size: 12px; }
.topbar .sep { width: 1px; height: 40px; background: #3A3A3A; }
.topbar .ghost { background: transparent; color: var(--gold); border: 1px solid var(--gold); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.topbar .ghost:hover { background: rgba(201,162,39,.12); }
.iconbtn { position: relative; background: transparent; border: 0; color: #fff; font-size: 20px; cursor: pointer; padding: 6px; border-radius: 8px; }
.iconbtn:hover { background: #2a2a2a; }
.badge { position: absolute; top: 0; inset-inline-end: 0; background: var(--red); color: #fff; border-radius: 10px; font-size: 11px;
  min-width: 18px; height: 18px; padding: 0 5px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: var(--black); font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.userbtn { background: transparent; border: 0; color: #fff; cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: start; padding: 4px 8px; border-radius: 8px; }
.userbtn:hover { background: #2a2a2a; }
.userbtn .r { color: #bdbdbd; font-size: 12px; }
.burger { display: none; }

.body { flex: 1; display: flex; min-height: 0; }
.side { width: 245px; flex: none; background: linear-gradient(180deg, #161616, #0A0A0A); color: #E8E8E8; display: flex; flex-direction: column;
  position: sticky; top: 74px; height: calc(100vh - 74px); }
.side nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.side nav::-webkit-scrollbar { width: 6px; } .side nav::-webkit-scrollbar-thumb { background: #3A3A3A; border-radius: 3px; }
.side a { display: flex; align-items: center; gap: 10px; color: #E8E8E8; padding: 10px 14px; margin: 3px 0; border-radius: 10px; font-size: 14.5px; }
.side a:hover { background: #232323; }
.side a.on { background: linear-gradient(90deg, #B8901C, #D9B54A); color: var(--black); font-weight: 800; }
.side a .ic { width: 22px; text-align: center; }
.side a .cnt { margin-inline-start: auto; background: var(--red); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 700; }
.side .tag { color: var(--gold); font-weight: 800; text-align: center; padding: 14px 10px 18px; font-size: 14px; }
.main { flex: 1; min-width: 0; padding: 14px; }
.content { background: #fff; border-radius: 14px; border: 1px solid var(--line); min-height: calc(100vh - 140px); padding: 18px 20px; }
.statusbar { display: flex; justify-content: space-between; padding: 6px 16px; background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.statusbar .on { color: var(--green); font-weight: 700; }

/* ---------------- headings ---------------- */
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 800; }
.page-head .sub { color: var(--muted); }
h2.section { font-size: 15px; color: var(--gold-dark); margin: 18px 0 8px; }

/* ---------------- buttons ---------------- */
.btn { background: #fff; border: 1px solid #D5D8DE; border-radius: 8px; padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--gold); background: #FFFCF2; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--black); color: var(--gold); border-color: var(--black); font-weight: 700; }
.btn.primary:hover { background: var(--black2); }
.btn.gold { background: linear-gradient(90deg, #C9A227, #DDBB55); color: var(--black); border-color: var(--gold-dark); font-weight: 700; }
.btn.big { padding: 13px; font-size: 16px; font-weight: 800; border-radius: 10px; justify-content: center; width: 100%; border: 0; background: linear-gradient(90deg, #C29B25, #DCBB5A); color: var(--black); }
.btn.danger { color: #A4161A; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--gold-dark); padding: 2px 4px; }

/* ---------------- inputs ---------------- */
input[type=text], input[type=password], input[type=number], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=search], select, textarea {
  background: #fff; border: 1px solid #D5D8DE; border-radius: 8px; padding: 7px 10px; min-height: 36px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.15); }
.invalid { border-color: #C62828 !important; background: #FFF5F5 !important; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.search { max-width: 420px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar select { width: auto; min-width: 140px; }

.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.form.one { grid-template-columns: 1fr; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form .f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form .f.full { grid-column: 1 / -1; }
.form .f > label { font-size: 13px; color: #374151; font-weight: 600; }
.form .f > label .req { color: var(--red); }
.form .f .hint { font-size: 12px; color: var(--muted); }
.form .sep { grid-column: 1 / -1; color: var(--gold-dark); font-weight: 800; border-bottom: 1px solid var(--line); padding: 6px 0 4px; margin-top: 4px; }

/* ---------------- cards ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); }
.card .lb { font-weight: 700; }
.card .v { font-size: 26px; font-weight: 800; line-height: 1.2; margin-top: 2px; }
.card .lk { font-size: 12px; cursor: pointer; }
.card .ic { width: 44px; height: 44px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; flex: none; margin-inline-start: auto; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel h3 { margin: 0 0 8px; font-size: 16px; }
.info-card { background: #F7F4EA; border: 1px solid #EFE4C2; border-radius: var(--radius); padding: 14px; }
.info-card b { color: var(--gold-dark); }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }

/* ---------------- tables ---------------- */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; max-height: calc(100vh - 290px); }
.tbl-wrap.auto { max-height: none; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
table.tbl th { background: #F4F5F7; position: sticky; top: 0; z-index: 2; text-align: start; padding: 10px 10px; font-weight: 700; color: #374151; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
table.tbl th.nosort { cursor: default; }
table.tbl td { padding: 8px 10px; border-bottom: 1px solid #F0F1F4; white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
table.tbl td.wrap { white-space: normal; }
table.tbl tbody tr:nth-child(even) td { background: #FAFAFB; }
table.tbl tbody tr:hover td { background: #FFFBEA; cursor: pointer; }
table.tbl tbody tr.sel td { background: var(--gold-light) !important; }
table.tbl tr.r-red td { background: var(--red-bg) !important; }
table.tbl tr.r-amber td { background: var(--amber-bg) !important; }
table.tbl tr.r-green td { background: var(--green-bg) !important; }
table.tbl tr.r-gray td { background: var(--gray-bg) !important; color: #888; }
table.tbl tr.r-bold td { font-weight: 800; background: #F6F1E0 !important; }
table.tbl td.num, table.tbl th.num { text-align: end; font-variant-numeric: tabular-nums; }
table.tbl .acts { display: flex; gap: 5px; }
.act { width: 28px; height: 26px; border: 0; border-radius: 6px; color: #fff; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.act:hover { filter: brightness(.88); }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.tbl-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; padding: 6px 2px; }

.pill { display: inline-block; padding: 2px 11px; border-radius: 999px; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.pill.red { background: #FDE1E3; color: #C53030; } .pill.amber { background: #FFEFC2; color: #B7791F; }
.pill.green { background: #D8F3E2; color: #15803D; } .pill.gray { background: #ECEDEF; color: #6B7280; }
.pill.blue { background: #DCE8FF; color: #1D4ED8; } .pill.purple { background: #EDE5FF; color: #6D28D9; }
.pill.gold { background: var(--gold-light); color: var(--gold-dark); }

/* ---------------- tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { background: #EEF0F3; border: 0; padding: 8px 16px; border-radius: 8px 8px 0 0; cursor: pointer; color: #4B5563; white-space: nowrap; }
.tabs button.on { background: #fff; color: var(--gold-dark); font-weight: 800; border-top: 2px solid var(--gold); box-shadow: 0 -1px 0 var(--line) inset; }

/* ---------------- modal ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(15,15,20,.45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 30px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; max-height: calc(100vh - 60px); }
.modal.wide { max-width: 980px; } .modal.xwide { max-width: 1200px; } .modal.narrow { max-width: 440px; }
.modal .mh { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal .mh h3 { margin: 0; font-size: 17px; flex: 1; }
.modal .mh .x { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal .mb { padding: 16px 18px; overflow-y: auto; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.codebadge { background: var(--black); color: var(--gold); font-weight: 800; padding: 3px 10px; border-radius: 6px; font-size: 13px; }

/* ---------------- dropdown menus ---------------- */
.menu { position: absolute; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; min-width: 220px; z-index: 50; }
.menu button, .menu a { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 9px 12px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.menu button:hover, .menu a:hover { background: var(--gold-light); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.notes { width: 360px; max-height: 70vh; overflow-y: auto; }
.notes .n { padding: 9px 10px; border-bottom: 1px solid #F0F1F4; cursor: pointer; border-radius: 6px; }
.notes .n:hover { background: #FBF8EE; }
.notes .n .tt { font-weight: 700; }
.notes .n .tm { font-size: 11.5px; color: var(--muted); }

/* ---------------- toast ---------------- */
#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--black); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); border-inline-start: 4px solid var(--gold); max-width: 420px; animation: tin .2s ease-out; }
.toast.err { border-color: var(--red); } .toast.ok { border-color: var(--green); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* ---------------- login ---------------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, #2a2410 0, #0d0d0d 55%); }
.auth .box { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.5); border-top: 4px solid var(--gold); }
.auth .box.wide { max-width: 720px; }
.auth h1 { margin: 0 0 4px; font-size: 24px; } .auth .brand { color: var(--gold-dark); font-weight: 800; letter-spacing: .3px; }
.auth .logo { max-height: 70px; display: block; margin: 0 auto 10px; }
.auth .err { color: #C53030; min-height: 20px; font-size: 13px; }
.steps { display: flex; gap: 6px; margin: 10px 0 16px; } .steps span { flex: 1; height: 4px; border-radius: 2px; background: #eee; } .steps span.on { background: var(--gold); }

/* ---------------- dashboard extras ---------------- */
.recent .it { display: flex; align-items: center; gap: 8px; padding: 9px 4px; border-bottom: 1px solid #EEF0F3; cursor: pointer; }
.recent .it:hover { background: #FBF8EE; }
.recent .it .t { font-weight: 700; }
.recent .it .s { font-size: 12px; color: var(--muted); }

/* ---------------- kanban (CRM) ---------------- */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; align-items: flex-start; }
.board .colm { background: #F6F7F9; border: 1px solid var(--line); border-radius: 12px; min-width: 230px; width: 230px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 300px); }
.board .colm.won { background: #EEF9F2; } .board .colm.lost { background: #FDF1F2; }
.board .colm h4 { margin: 0; padding: 10px 12px; color: var(--gold-dark); font-size: 14px; border-bottom: 1px solid var(--line); }
.board .colm .list { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.board .colm.drop { outline: 2px dashed var(--gold); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; cursor: grab; box-shadow: var(--shadow); font-size: 13px; }
.kcard .n { font-weight: 800; } .kcard.late { border-inline-start: 4px solid var(--red); }

/* ---------------- files ---------------- */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.file { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fff; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.file .thumb { height: 100px; border-radius: 6px; background: #F4F5F7 center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 34px; }
.file .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-zone { border: 2px dashed #D5D8DE; border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 10px; }
.drop-zone.on { border-color: var(--gold); background: #FFFBEA; }

/* ---------------- inbox ---------------- */
.chat { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - 175px); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.chat .lst { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #fff; }
.chat .lst .items { overflow-y: auto; flex: 1; }
.chat .ci { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #F3F4F6; }
.chat .ci:hover { background: #F9F9F7; } .chat .ci.on { background: #F6EDCF; }
.chat .ci .nm { font-weight: 800; } .chat .ci .pv { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat .conv { display: flex; flex-direction: column; min-height: 0; background: #EFEAE2; }
.chat .conv .hd { background: #fff; padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 14px 6%; display: flex; flex-direction: column; gap: 6px; }
.bub { max-width: 70%; padding: 7px 10px 5px; border-radius: 10px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.08); white-space: pre-wrap; word-wrap: break-word; font-size: 14px; align-self: flex-start; }
.bub.out { background: #F6EDCF; align-self: flex-end; }
.bub .meta { font-size: 11px; color: var(--muted); text-align: end; margin-top: 2px; }
.bub img, .bub video { max-width: 280px; max-height: 300px; border-radius: 8px; display: block; }
.bub audio { max-width: 260px; }
.daysep { align-self: center; background: #E1F2FB; color: #555; font-size: 12px; padding: 3px 10px; border-radius: 8px; }
.chat .composer { background: #F0F0F0; padding: 8px; display: flex; gap: 8px; align-items: flex-end; }
.chat .composer textarea { min-height: 40px; max-height: 140px; border-radius: 20px; }

/* ---------------- print helpers / misc ---------------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv .k { color: var(--muted); }
.totals { margin-top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.totals .t { display: flex; gap: 20px; min-width: 260px; justify-content: space-between; }
.totals .t.big { font-weight: 800; font-size: 16px; border-top: 2px solid var(--gold); padding-top: 4px; }
.lines td input, .lines td select { min-height: 32px; padding: 4px 6px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 14px; }
.tree .acc { padding: 6px 8px; border-bottom: 1px solid #F3F4F6; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.tree .acc:hover { background: #FBF8EE; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.spin { display: inline-block; width: 18px; height: 18px; border: 3px solid #e5e5e5; border-top-color: var(--gold); border-radius: 50%; animation: sp 1s linear infinite; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------------- responsive ---------------- */
.burger-back { display: none; }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .burger { display: inline-flex; }
  .side { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; height: 100vh; z-index: 60; transform: translateX(110%); transition: transform .2s; }
  [dir=ltr] .side { transform: translateX(-110%); }
  .side.open { transform: none !important; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
  .topbar { padding: 8px 10px; gap: 8px; min-height: 60px; }
  .topbar .sub, .topbar .clock, .topbar .sep, .topbar .ghost, .userbtn .txt { display: none; }
  .topbar .title { font-size: 16px; } .topbar .logo { height: 38px; }
  .main { padding: 8px; } .content { padding: 12px; border-radius: 10px; }
  .form, .form.three { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - 150px); }
  .chat.open .lst { display: none; } .chat:not(.open) .conv { display: none; }
  .bub { max-width: 88%; }
  .burger-back { display: inline-flex; }
  .tbl-wrap { max-height: none; }
  .modal { max-height: none; } .overlay { padding: 0; } .modal { border-radius: 0; min-height: 100vh; }
}
@media print { .topbar, .side, .statusbar, .toolbar, .no-print { display: none !important; } .content { border: 0; } }
