/* Tatweer — palette taken from the logo: blue #157ABE, deep blue #055288, ink #0B0B0B */
@font-face { font-family: Outfit; font-weight: 400; src: url(../fonts/outfit-400.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Outfit; font-weight: 500; src: url(../fonts/outfit-500.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Outfit; font-weight: 700; src: url(../fonts/outfit-700.woff2) format('woff2'); font-display: swap; }

:root {
  --blue: #157abe; --deep: #055288; --ink: #0b0b0b; --sky: #e8f2fa; --line: #dde7ef;
  --bg: #f5f8fb; --card: #fff; --muted: #6b7b88; --ok: #1d9a6c; --warn: #d98a00; --bad: #d03a3a;
  --r: 14px; --shadow: 0 6px 24px rgba(var(--deep-rgb), .08);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 Outfit, system-ui, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; } a:hover { color: var(--deep); }
h1, h2, h3, h4 { margin: 0 0 .6rem; font-weight: 700; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .center { text-align: center; } .r { text-align: right; } .bad { color: var(--bad); font-weight: 500; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pad { padding: 16px 18px 0; }

/* shell */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--deep), var(--deep2)); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: block; padding: 6px 10px 18px; } .brand img { width: 100%; max-width: 190px; animation: pop .8s cubic-bezier(.2, 1.4, .4, 1) both; }
.sidebar nav { flex: 1; }
.sidebar details { margin-bottom: 4px; animation: slideIn .5s ease both; animation-delay: calc(var(--i) * 60ms); }
.sidebar summary { cursor: pointer; padding: 9px 12px; border-radius: 10px; list-style: none; font-weight: 500; opacity: .9; transition: background .2s, transform .2s; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary span { margin-left: 6px; } .sidebar summary:hover { background: rgba(255, 255, 255, .1); transform: translateX(3px); }
.sidebar summary::first-letter { opacity: .6; }
.sidebar details[open] summary { background: rgba(255, 255, 255, .08); }
.sidebar details a { display: block; color: #cfe4f4; padding: 7px 12px 7px 38px; border-radius: 8px; font-size: .93rem; position: relative; transition: all .2s; }
.sidebar details a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sidebar details a.on { color: #fff; background: var(--blue); box-shadow: 0 4px 14px rgba(var(--blue-rgb), .5); }
.sidebar details a.on::before { content: ''; position: absolute; left: 20px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #fff; animation: pulse 2s infinite; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid rgba(255, 255, 255, .15); font-size: .9rem; }
.me small { display: block; opacity: .7; } .me form { margin-left: auto; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); display: grid; place-items: center; font-weight: 700; }
main { padding: 22px 28px 40px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; } .top h1 { margin: 0; font-size: 1.6rem; animation: slideIn .5s ease both; }
.burger { display: none; background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; font-size: 1.1rem; }
.page { animation: fadeUp .45s ease both; }
.crumbs { margin-bottom: 12px; color: var(--muted); }

/* cards & grids */
.card { background: var(--card); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; transition: transform .25s, box-shadow .25s; }
.grid { display: grid; gap: 18px; } .grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); } .grid.cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { position: relative; overflow: hidden; margin: 0; animation: fadeUp .5s ease both; animation-delay: calc(var(--i) * 80ms); }
.kpi::after { content: ''; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: radial-gradient(var(--sky), transparent 70%); transition: transform .4s; }
.kpi:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(var(--deep-rgb), .16); } .kpi:hover::after { transform: scale(1.6); }
.kpi strong { display: block; font-size: 1.75rem; color: var(--deep); line-height: 1.2; } .kpi small { color: var(--muted); }
.grid + .grid, .grid + .card { margin-top: 18px; }

/* buttons & forms */
.btn { display: inline-block; background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 9px 18px; font: inherit; font-weight: 500; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s; }
.btn:hover { background: var(--deep); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(var(--blue-rgb), .35); } .btn:active { transform: none; }
.btn.ghost { background: var(--sky); color: var(--deep); } .btn.ghost:hover { background: var(--blue-soft); color: var(--deep); box-shadow: none; }
.btn.danger { color: var(--bad); } .btn.wide { width: 100%; padding: 12px; }
button.link { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; } button.link.danger, .danger { color: var(--bad); }
button.ghost { background: transparent; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; } .btns form { margin: 0; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(var(--blue-rgb), .15); }
label { display: block; font-weight: 500; font-size: .9rem; color: var(--deep); } label input, label select, label textarea { margin-top: 5px; font-weight: 400; color: var(--ink); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 14px; } .full { grid-column: 1 / -1; }
.form label { margin-bottom: 12px; } .fields label { margin: 0; }
.inline { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; } .inline input, .inline select { width: auto; flex: 1; min-width: 110px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.search { display: flex; gap: 8px; flex-wrap: wrap; } .search input { width: 220px; } .search select { width: auto; }
.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 14px; animation: fadeUp .35s ease both; }
.flash.ok { background: #e3f6ee; color: #11694a; } .flash.err { background: #fbe6e6; color: #912a2a; } .flash.warn { background: #fff3d8; color: #7a5200; }

/* tables */
.tablecard { padding: 0; overflow-x: auto; } table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; } td.r, th.r { text-align: right; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafcfe; } th a { color: inherit; }
tbody tr { transition: background .15s; } tbody tr:hover { background: var(--sky); } tbody tr:last-child td { border-bottom: 0; }
td.empty { text-align: center; color: var(--muted); padding: 30px; } td.actions { display: flex; gap: 12px; justify-content: flex-end; } td.actions form { margin: 0; }
tr.struck td { text-decoration: line-through; color: var(--muted); } tfoot td { font-weight: 500; } tr.grand td { font-weight: 700; font-size: 1.05rem; color: var(--deep); background: var(--sky); }
.foot { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.pager { display: flex; gap: 6px; } .pager a { padding: 5px 11px; border-radius: 8px; background: #fff; } .pager a.on { background: var(--blue); color: #fff; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; } .tabs a { padding: 8px 16px; border-radius: 999px; background: #fff; color: var(--deep); transition: all .2s; } .tabs a.on, .tabs a:hover { background: var(--blue); color: #fff; }
.badge { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: .78rem; font-weight: 500; background: var(--sky); color: var(--deep); text-transform: capitalize; }
.b-paid, .b-active, .b-converted, .b-accepted, .b-done, .b-delivered, .b-issued, .b-qualified { background: #e0f5ec; color: #11694a; }
.b-overdue, .b-lost, .b-rejected, .b-cancelled, .b-high, .b-inactive { background: #fbe3e3; color: #912a2a; }
.b-partial, .b-negotiation, .b-waiting, .b-sent { background: #fff0cc; color: #7a5200; }
.rowitem { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); color: var(--ink); } .rowitem:hover { color: var(--blue); } .rowitem:last-child { border: 0; }
dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; } dt { color: var(--muted); } dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); } .timeline li { padding: 8px 0 8px 16px; position: relative; animation: slideIn .4s ease both; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); } .timeline small { display: block; color: var(--muted); }
.lines input, .lines select { padding: 6px 8px; } .lines td { padding: 6px; } .lines .num { width: 80px; text-align: right; } .lines td:nth-child(2) input { min-width: 220px; }
.totals { text-align: right; font-size: 1.1rem; margin: 14px 0; } .totals strong { color: var(--deep); font-size: 1.4rem; }

/* login */
.bare { background: linear-gradient(135deg, var(--deep), var(--blue)); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden; }
.blobs i { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); animation: float 12s ease-in-out infinite; }
.blobs i:nth-child(1) { width: 380px; height: 380px; left: -90px; top: -90px; } .blobs i:nth-child(2) { width: 260px; height: 260px; right: 8%; bottom: 6%; animation-delay: -4s; } .blobs i:nth-child(3) { width: 140px; height: 140px; right: 24%; top: 10%; animation-delay: -8s; }
.login-card { position: relative; background: #fff; width: 100%; max-width: 410px; padding: 34px 32px; border-radius: 22px; box-shadow: 0 30px 70px rgba(0, 0, 0, .3); animation: pop .8s cubic-bezier(.2, 1.3, .4, 1) both; }
.login-card label { margin-bottom: 14px; } .login-logo { display: block; width: 78%; margin: 0 auto 6px; animation: float 5s ease-in-out infinite; }

/* print */
body.print { background: #fff; } .sheet { max-width: 820px; margin: 24px auto; padding: 0 20px; }
@media print { .noprint { display: none; } .sheet { margin: 0; } }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .6); } 100% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; } .burger { display: block; }
  .sidebar { position: fixed; z-index: 20; width: 270px; left: -290px; transition: left .3s; } .sidebar.show { left: 0; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  main { padding: 16px; } dl { grid-template-columns: 110px 1fr; }
}
