/* ============================================================
   Aiconmac HR Portal — interface styling (Zoho-style)
   ============================================================ */
:root {
  /* AICONMAC 3D brand palette — Orange #EF5F22 + Graphite #464646 */
  --bg: #f5f4f2;        /* brand off-white */
  --surface: #ffffff;
  --ink: #1c1c1c;       /* near-black for headings/figures */
  --ink-soft: #464646;  /* graphite body text */
  --muted: #8a8a8a;     /* brand mid-gray */
  --line: #e8e6e3;
  --line-soft: #f2f1ee;

  --primary: #EF5F22;       /* AICONMAC orange */
  --primary-ink: #c94a15;   /* darker orange for hover / links */
  --primary-soft: #fdeee7;  /* soft orange tint */
  --graphite: #464646;

  --c-blue:#EF5F22;   --c-blue-bg:#fdeee7;   /* repointed to brand orange */
  --c-green:#15a06a;  --c-green-bg:#e3f6ee;
  --c-amber:#dd9008;  --c-amber-bg:#fdf2db;
  --c-purple:#7a5ce0; --c-purple-bg:#efeafc;
  --c-teal:#0fafb4;   --c-teal-bg:#dff6f6;
  --c-red:#e0484d;    --c-red-bg:#fdeaeb;

  --shadow-sm: 0 1px 2px rgba(28,28,28,.06);
  --shadow: 0 6px 22px rgba(28,28,28,.08);
  --shadow-lg: 0 18px 50px rgba(28,28,28,.16);

  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 252px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-ink); }
.ic { display: block; flex-shrink: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.topbar .brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 17px; color: var(--ink); }
.topbar .brand:hover { color: var(--ink); }
.topbar .brand-logo { height: 38px; width: auto; display: block; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #f5763b, #d34a12);
  color: #fff; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(239,95,34,.35);
}
.logo-mark-img { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; object-fit: contain; }
.brand-name { font-family: "Montserrat", sans-serif; font-weight: 800; letter-spacing:.01em; text-transform: uppercase; }
.brand small { display:block; font-weight: 600; font-size: 11px; color: var(--muted); letter-spacing:.14em; text-transform: uppercase; }
.userbox { display: flex; align-items: center; gap: 12px; }
.userbox .meta { text-align: right; line-height: 1.25; }
.userbox .meta .nm { font-weight: 600; font-size: 14px; }
.userbox .meta .rl { font-size: 12px; color: var(--muted); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #EF5F22, #464646);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.signout {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 13px; font-weight: 600;
  border: 1px solid var(--line);
}
.signout:hover { background: var(--line-soft); color: var(--ink); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); align-items: stretch; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
}
.sidebar .group {
  padding: 18px 12px 8px; font-size: 11px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.sidebar a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 14.5px; font-weight: 500;
}
.sidebar a .ic { color: var(--muted); transition: color .15s; }
.sidebar a:hover { background: var(--line-soft); color: var(--ink); }
.sidebar a:hover .ic { color: var(--ink-soft); }
.sidebar a.active {
  background: var(--primary-soft); color: var(--primary-ink); font-weight: 600;
}
.sidebar a.active .ic { color: var(--primary); }

.content { flex: 1; padding: 30px 38px; max-width: 1120px; width: 100%; }

/* ---------- Headings ---------- */
.page-head { margin-bottom: 22px; }
h1 { font-family: "Montserrat", sans-serif; font-size: 25px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-family: "Montserrat", sans-serif; font-size: 17px; font-weight: 700; margin: 30px 0 14px; letter-spacing: -.01em; }
.card-title { font-family: "Montserrat", sans-serif; }
.sub { color: var(--muted); margin: 0; font-size: 14.5px; }

/* ---------- Hero banner ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, #2f2f2f 0%, #464646 55%, #5a5a5a 100%);
  color: #fff; border-radius: var(--radius);
  padding: 26px 28px; margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.hero h1 { color: #fff; }
.hero .sub { color: rgba(255,255,255,.85); }
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(239,95,34,.22);
}
.hero::before {
  content: ""; position: absolute; right: 70px; bottom: -70px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(239,95,34,.14);
}
.hero .date-pill {
  display:inline-flex; align-items:center; gap:7px; margin-top:10px;
  background: rgba(255,255,255,.16); padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 16px; }

/* ---------- Metric cards ---------- */
.metrics { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); margin-bottom: 4px; }
.metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s;
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.metric-icon {
  width: 50px; height: 50px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.metric-num { font-size: 27px; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; }
.metric-lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }
.metric-icon.blue   { background: var(--c-blue-bg);   color: var(--c-blue); }
.metric-icon.green  { background: var(--c-green-bg);  color: var(--c-green); }
.metric-icon.amber  { background: var(--c-amber-bg);  color: var(--c-amber); }
.metric-icon.purple { background: var(--c-purple-bg); color: var(--c-purple); }
.metric-icon.teal   { background: var(--c-teal-bg);   color: var(--c-teal); }
.metric-icon.red    { background: var(--c-red-bg);    color: var(--c-red); }

/* small stat (used in summaries) */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.stat .num { font-size: 26px; font-weight: 750; color: var(--ink); letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 11px 14px; background: var(--line-soft);
  color: var(--muted); font-weight: 700; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
thead th:first-child { border-top-left-radius: 10px; }
thead th:last-child { border-top-right-radius: 10px; }
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
td strong, th strong { color: var(--ink); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content:""; width:6px; height:6px; border-radius:50%; background: currentColor; opacity:.9; }
.badge.green  { background: var(--c-green-bg);  color: var(--c-green); }
.badge.red    { background: var(--c-red-bg);    color: var(--c-red); }
.badge.amber  { background: var(--c-amber-bg);  color: var(--c-amber); }
.badge.gray   { background: #eef1f6;            color: var(--muted); }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; color: var(--ink-soft); margin: 14px 0 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239,95,34,.15);
}
.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit; margin-top: 18px;
  box-shadow: 0 4px 12px rgba(239,95,34,.28); transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.06); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 7px 13px; font-size: 13px; margin: 0; box-shadow: none; }
.btn.ghost { background: var(--surface); color: var(--primary-ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--line-soft); }
.btn.danger { background: var(--c-red); box-shadow: 0 4px 12px rgba(224,72,77,.25); }
.btn.green { background: var(--c-green); box-shadow: 0 4px 12px rgba(21,160,106,.25); }

/* ---------- Flash messages ---------- */
.flash {
  display:flex; align-items:center; gap:9px;
  padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 14px; font-weight: 500; border: 1px solid transparent;
}
.flash.ok { background: var(--c-green-bg); color: #0e7a50; border-color: #c4ecd8; }
.flash.error { background: var(--c-red-bg); color: #c0353a; border-color: #f6cdcf; }

/* ---------- Misc ---------- */
.inline-form { display: inline; }
.muted { color: var(--muted); }
.right { text-align: right; }
.tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--primary-soft); color: var(--primary-ink); padding: 2px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; }
.toolbar { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:16px; flex-wrap:wrap; }
.actions { display: inline-flex; gap: 8px; align-items: center; }

.dl { display: grid; grid-template-columns: 180px 1fr; gap: 0; font-size: 14.5px; }
.dl dt { color: var(--muted); padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.dl dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: none; }

.empty { text-align:center; padding: 34px 16px; color: var(--muted); }
.empty .ic { margin: 0 auto 10px; color: var(--line); width:40px; height:40px; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
.login-aside {
  position: relative; overflow: hidden; color: #fff; padding: 56px;
  background: linear-gradient(140deg, #1c1c1c 0%, #3a3a3a 55%, #4c4c4c 100%);
  display: flex; flex-direction: column; justify-content: center;
}
.login-aside .logo-mark { width: 46px; height: 46px; font-size: 22px; border-radius: 12px; margin-bottom: 30px; }
.login-aside .brand-emblem { width: 84px; height: auto; display: block; margin-bottom: 28px; }
.login-aside h2 { font-family: "Montserrat", sans-serif; font-size: 30px; line-height: 1.25; margin: 0 0 14px; color: #fff; font-weight: 750; letter-spacing: -.01em; }
.login-aside p { color: rgba(255,255,255,.82); font-size: 15px; max-width: 380px; margin: 0; }
.login-aside ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 13px; }
.login-aside li { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: rgba(255,255,255,.92); }
.login-aside li .chk { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.18); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.login-aside::after { content:""; position:absolute; right:-90px; bottom:-90px; width:320px; height:320px; border-radius:50%; background:rgba(239,95,34,.16); }
.login-main { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 26px; margin-bottom: 6px; }
.login-card .sub { margin-bottom: 26px; }
.login-card .btn { width: 100%; margin-top: 22px; padding: 13px; }

/* Tablet / narrow window: keep the branded login panel as a top banner
   instead of hiding it, so the look stays polished. */
@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; min-height: 100vh; }
  .login-aside { padding: 34px 40px; }
  .login-aside .logo-mark { margin-bottom: 18px; }
  .login-aside h2 { font-size: 24px; }
  .login-aside ul { display: none; }
}
@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .group { width: 100%; padding: 6px 10px 2px; }
  .sidebar a { margin-bottom: 0; }
  .content { padding: 22px 18px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { padding-bottom: 0; border: none; }
}
@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr; }
  .userbox .meta { display: none; }
}

/* ---- Net position (house rule: no negatives, no parentheses) -------------
   Always two lines — "receivable from the company" and "payable to the
   company" — so the direction of the money is stated, never inferred from a
   minus sign. The line that carries the figure is the one that's coloured. */
.net-position { display: flex; flex-direction: column; gap: 6px; }
.net-position.compact { gap: 2px; }
.net-line {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 7px 10px; border-radius: 7px;
  border: 1px solid transparent; color: var(--muted);
}
.net-position.compact .net-line { padding: 3px 8px; }
.net-line .net-label { font-size: 13.5px; }
.net-line .net-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.net-line.is-active { font-weight: 600; }
.net-line.is-active.receivable {
  color: var(--c-green); background: var(--c-green-bg); border-color: var(--c-green);
}
.net-line.is-active.payable {
  color: var(--c-amber); background: var(--c-amber-bg); border-color: var(--c-amber);
}
/* Inline variant for dense table cells */
.dir { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.dir.receivable { color: var(--c-green); }
.dir.payable    { color: var(--c-amber); }
.dir .dir-word  { font-weight: 500; font-size: 12px; opacity: .85; }
