/*
 * Sankari ERPNext tracker — متابعة تطبيق ERPNext
 *
 * The palette is taken from the Sankari Holding sign-in page: the charcoal background, the brown
 * button, the cream logo, the tan divider and the neutral greys of its form. Everything else is
 * derived from those. Logical properties throughout (margin-inline-start, not margin-left), so the
 * same rules serve Arabic right-to-left and English left-to-right.
 */

:root {
    --ink: #26251f;
    --ink-2: #2f2e28;
    --ink-line: #484540;
    --brown: #75594c;
    --brown-700: #5e463b;
    --brown-50: #f5efea;
    --brown-100: #ebe1d9;
    --cream: #dacdc1;
    --cream-hi: #f6efe6;
    --tan: #d8c8c0;
    --paper: #f6f3ef;
    --card: #ffffff;
    --text: #26251f;
    --text-2: #5a554f;
    --muted: #7c7c7c;
    --border: #e2e2e2;
    --border-soft: #ece7e1;
    --pill: #f3f3f3;

    --ok: #4c7a57;
    --ok-bg: #eaf2ec;
    --warn: #a8742a;
    --warn-bg: #f8efdf;
    --bad: #a6473b;
    --bad-bg: #f7e6e3;
    --info: #4a6a80;
    --info-bg: #e7eef3;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(38, 37, 31, .05), 0 10px 28px rgba(38, 37, 31, .07);
    --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-ar: "Tajawal", "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
    --font-display: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font: 15px/1.6 var(--font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

html[lang="ar"] body { font-family: var(--font-ar); font-size: 16px; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
html[lang="en"] h1, html[lang="en"] .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
html[lang="ar"] h1, html[lang="ar"] .display { font-weight: 800; }
h1 { font-size: 30px; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }

a { color: var(--brown); text-decoration: none; }
a:hover { color: var(--brown-700); text-decoration: underline; }
p { margin: 0 0 .6em; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.soft { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 28px; } }

/* ------------------------------------------------------------------ top bar */

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar .wrap { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand img { height: 28px; width: auto; display: block; }
.brand span { font-size: 13px; color: var(--text-2); border-inline-start: 1px solid var(--border); padding-inline-start: 10px; white-space: nowrap; display: none; }
@media (min-width: 1180px) { .brand span { display: inline; } }

.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
    color: var(--text-2);
    padding: 18px 10px 16px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.on { color: var(--ink); border-bottom-color: var(--brown); font-weight: 700; }

.count {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--brown); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}

.tools { display: flex; align-items: center; gap: 10px; flex: none; }
.pill {
    background: var(--pill); color: var(--text-2); border-radius: 6px; padding: 5px 11px; font-size: 14px; white-space: nowrap;
}
.pill:hover { background: #ebebeb; color: var(--ink); text-decoration: none; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 8px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--pill); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--cream);
    display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}
.menu .who { display: none; line-height: 1.2; }
.menu .who b { display: block; font-size: 14px; }
.menu .who small { color: var(--muted); }
@media (min-width: 1180px) { .menu .who { display: block; } }
.menu .drop {
    position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 230px; background: #fff;
    border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 40;
}
.menu .drop .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.menu .drop a, .menu .drop button {
    display: block; width: 100%; text-align: start; padding: 8px 10px; border-radius: 6px; color: var(--text);
    background: none; border: 0; font: inherit; cursor: pointer;
}
.menu .drop a:hover, .menu .drop button:hover { background: var(--pill); text-decoration: none; }

/* ------------------------------------------------------------------ band (page head on charcoal) */

.band {
    background: var(--ink) url("/img/lines.svg") center / cover no-repeat;
    color: var(--cream);
    padding: 34px 0 78px;
}
.band .wrap { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; }
.band h1 { color: var(--cream-hi); }
.band .eyebrow { color: var(--tan); font-size: 13px; letter-spacing: .04em; margin-bottom: 6px; }
html[lang="en"] .band .eyebrow { text-transform: uppercase; }
.band .sub { color: #b8ada2; margin: 8px 0 0; max-width: 720px; }
.band .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.band a:not(.btn) { color: var(--cream); }

main.page { margin-top: -50px; padding-bottom: 48px; flex: 1; }

/* ------------------------------------------------------------------ cards, grids */

.card {
    background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px;
}
.card + .card, .stack > * + * { margin-top: 16px; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card > header .meta { color: var(--muted); font-size: 13px; }
.card.flat { box-shadow: none; }
.card.tint { background: var(--brown-50); border-color: var(--brown-100); box-shadow: none; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: minmax(0, 1fr); }
.g3 { grid-template-columns: minmax(0, 1fr); }
.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.side { grid-template-columns: minmax(0, 1fr); }
.grid > *, .stack > * { min-width: 0; }
@media (min-width: 760px) {
    .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
    .side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
}

.divider { width: 44px; height: 1px; background: var(--tan); margin: 14px auto; border: 0; }
hr.rule { border: 0; border-top: 1px solid var(--border-soft); margin: 16px 0; }

/* ------------------------------------------------------------------ progress */

.bar { height: 8px; border-radius: 4px; background: #efe9e3; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brown); border-radius: 4px; }
.bar.ok > i { background: var(--ok); }
.bar.thin { height: 5px; }
.progress { display: flex; flex-direction: column; gap: 5px; }
.progress .line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); }
.progress .line b { color: var(--ink); }
.progress.none .line { color: var(--muted); }

/* ------------------------------------------------------------------ chips */

.chip {
    display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px;
    font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--pill); color: var(--text-2);
    line-height: 1.6;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.brown { background: var(--brown-50); color: var(--brown-700); }
.chip.dark { background: var(--ink); color: var(--cream); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.high, .dot.bad { background: var(--bad); }
.dot.normal { background: var(--brown); }
.dot.low { background: var(--tan); }
.dot.ok { background: var(--ok); }

/* ------------------------------------------------------------------ buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
    border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); font: inherit;
    font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--tan); background: var(--brown-50); color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--brown); border-color: var(--brown); color: #fff; }
.btn.primary:hover { background: var(--brown-700); border-color: var(--brown-700); color: #fff; }
.btn.cream { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.btn.cream:hover { background: var(--cream-hi); }
.btn.outline-light { background: transparent; border-color: #5a564e; color: var(--cream); }
.btn.outline-light:hover { border-color: var(--cream); background: rgba(218, 205, 193, .08); color: var(--cream-hi); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: #e7c4bf; }
.btn.ok { color: var(--ok); }
.btn.ok:hover { background: var(--ok-bg); border-color: #c5dccb; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12.5px; border-radius: 5px; }
.btn.block { width: 100%; height: 48px; font-size: 16px; }
.btn.link { border: 0; background: none; color: var(--brown); padding: 0; height: auto; font-weight: 500; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------ forms */

.form { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { color: var(--muted); font-size: 14px; }
.field .req::after { content: " *"; color: var(--bad); }
.field .hint { color: var(--muted); font-size: 12.5px; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=date],
.field input[type=search], .field select, .field textarea {
    width: 100%; height: 46px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff;
    padding: 0 14px; font: inherit; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 110px; padding: 11px 14px; resize: vertical; line-height: 1.55; }
.field select { padding-inline-end: 30px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--brown); box-shadow: 0 0 0 3px rgba(117, 89, 76, .14);
}
.field.error input, .field.error select, .field.error textarea, .input-validation-error { border-color: var(--bad) !important; }
.field-validation-error { color: var(--bad); font-size: 13px; }
.field-validation-valid { display: none; }
.validation-summary-errors {
    background: var(--bad-bg); color: var(--bad); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px;
}
.validation-summary-errors ul { margin: 0; padding-inline-start: 18px; }
.validation-summary-valid { display: none; }

.icon-input { position: relative; }
.icon-input > svg { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: #9a9a9a; pointer-events: none; }
.icon-input > input { padding-inline-start: 40px !important; }
.icon-input > .eye { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px; color: #9a9a9a; cursor: pointer; border-radius: 6px; }
.icon-input > .eye:hover { color: var(--ink); }
.icon-input.has-eye > input { padding-inline-end: 44px !important; }

.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice .box {
    display: block; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff;
    transition: border-color .15s, background .15s;
}
.choice .box b { display: block; font-size: 15px; }
.choice .box small { color: var(--muted); }
.choice input:checked + .box { border-color: var(--brown); background: var(--brown-50); box-shadow: inset 0 0 0 1px var(--brown); }
.choice input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(117, 89, 76, .25); }

.row2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .row2 { grid-template-columns: 1fr 1fr; } }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input { height: 38px; flex: 1; min-width: 160px; }

/* ------------------------------------------------------------------ toolbar, tabs, segmented */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; }
.toolbar .group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar select.input { height: 38px; width: auto; min-width: 150px; }

.seg { display: inline-flex; background: var(--pill); border-radius: 8px; padding: 3px; gap: 2px; }
.seg a {
    padding: 6px 14px; border-radius: 6px; color: var(--text-2); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.seg a:hover { text-decoration: none; color: var(--ink); background: #e9e9e9; }
.seg a.on { background: var(--ink); color: var(--cream); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper .label { font-weight: 700; padding: 0 8px; min-width: 0; text-align: center; }
.stepper a.arrow {
    width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--border); color: var(--text-2); background: #fff;
}
.stepper a.arrow:hover { border-color: var(--tan); text-decoration: none; color: var(--ink); }
html[dir="rtl"] .stepper svg { transform: scaleX(-1); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 600; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brown); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfaf8; }
.table .t { font-weight: 700; color: var(--ink); }
.table .t:hover { color: var(--brown); }

/* ------------------------------------------------------------------ lists inside cards */

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--border-soft); display: flex; gap: 10px; align-items: flex-start; }
.list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.list > li:first-child { padding-top: 0; }
.list .grow { flex: 1; min-width: 0; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

.history { list-style: none; margin: 0; padding: 0; position: relative; }
.history > li { position: relative; padding-inline-start: 22px; padding-bottom: 16px; }
.history > li::before { content: ""; position: absolute; inset-inline-start: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--tan); }
.history > li::after { content: ""; position: absolute; inset-inline-start: 9px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.history > li:last-child::after { display: none; }
.history .when { font-size: 12.5px; color: var(--muted); }
.history .what { font-size: 14px; }
.diff { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13.5px; display: grid; gap: 4px; }
.diff li { background: #faf8f5; border-radius: 6px; padding: 6px 9px; overflow-wrap: anywhere; }
.diff .f { color: var(--muted); font-size: 12.5px; display: block; }
.diff del { color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(166, 71, 59, .5); }
.diff ins { color: var(--ok); text-decoration: none; }

.drop-zone {
    border: 1.5px dashed var(--tan); border-radius: 10px; padding: 16px; text-align: center; background: #fcfaf8; color: var(--text-2);
    display: block; cursor: pointer; transition: background .15s, border-color .15s;
}
.drop-zone:hover, .drop-zone.over { background: var(--brown-50); border-color: var(--brown); }
.drop-zone input { display: none; }
.drop-zone b { color: var(--brown); }

/* ------------------------------------------------------------------ flashes */

.toast {
    position: fixed; inset-inline-end: 18px; bottom: 18px; background: var(--ink); color: var(--cream-hi); border-radius: 10px;
    padding: 12px 16px; box-shadow: var(--shadow); z-index: 50; max-width: min(420px, calc(100vw - 36px));
    display: flex; gap: 10px; align-items: center; animation: toast-in .25s ease-out;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cream); flex: none; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.alert { border-radius: 10px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: #7d5519; }
.alert.info { background: #fff; border: 1px solid var(--brown-100); color: var(--text); }
.flash-stack { display: grid; gap: 10px; margin-bottom: 16px; }

/* ------------------------------------------------------------------ sign-in and sign-up (the screenshot's page) */

body.auth { background: var(--ink); }
.auth-top { background: #fff; border-bottom: 1px solid var(--border); }
.auth-top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.auth-top img { height: 28px; }
.auth-main {
    flex: 1; background: var(--ink) url("/img/lines.svg") center / cover no-repeat;
    padding: 56px 16px 64px; display: flex; flex-direction: column; align-items: center;
}
.auth-logo { width: min(330px, 76vw); height: auto; margin-bottom: 44px; }
.auth-card {
    width: 100%; max-width: 460px; background: #fff; border-radius: 10px; padding: 38px 36px 34px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, .28);
}
.auth-card.wide { max-width: 640px; }
@media (max-width: 480px) { .auth-card { padding: 28px 20px 24px; } }
.auth-card h1 { text-align: center; font-size: 28px; color: var(--ink); }
.auth-card .lead { text-align: center; color: var(--text-2); margin: 10px 0 0; font-size: 15px; }
.auth-card .forgot { text-align: end; margin-top: -6px; font-size: 14px; color: var(--muted); }
.auth-card .alt { text-align: center; margin-top: 18px; color: var(--text-2); font-size: 14.5px; }
.auth-card .done-mark {
    width: 64px; height: 64px; border-radius: 50%; background: var(--brown-50); color: var(--brown); display: grid; place-items: center; margin: 0 auto 18px;
}
footer.foot { color: var(--muted); font-size: 12.5px; padding: 18px 0 26px; text-align: center; }
body.auth footer.foot { background: var(--ink); color: #8d847b; }

.page-404 { text-align: center; padding: 40px 20px; }
.page-404 .code { font-size: 64px; font-weight: 800; color: var(--tan); line-height: 1; }

/* Phones: the navigation takes a row of its own under the logo, so every section stays reachable. */
@media (max-width: 720px) {
    .brand img { height: 22px; }
    .topbar .wrap { gap: 0 10px; flex-wrap: wrap; justify-content: space-between; }
    .nav { order: 3; flex: 0 0 calc(100% + 32px); border-top: 1px solid var(--border-soft); margin-inline: -16px; padding-inline: 6px; }
    .nav a { padding: 11px 10px 9px; }
}

@media print {
    .topbar, .band .actions, .toast, .no-print { display: none !important; }
    .band { background: none; color: var(--ink); padding: 0 0 12px; }
    .band h1 { color: var(--ink); }
    main.page { margin-top: 0; }
    .card { box-shadow: none; border-color: #ddd; }
}
