/* Taskxly design system — tokens are overridden per company from branding settings. */
:root {
  --brand: #2563EB;
  --brand-ink: #ffffff;
  --brand-soft: rgba(37, 99, 235, 0.10);
  --bg: #F8FAFC;
  --surface: #ffffff;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --muted: #64748B;
  --border: #E2E8F0;
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --sidebar-w: 248px;
}

[data-theme="dark"] {
  --bg: #0B1120;
  --surface: #111827;
  --surface-2: #1E293B;
  --text: #E2E8F0;
  --muted: #94A3B8;
  --border: #1E293B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -0.015em; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .85em; letter-spacing: -.02em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* Layout ------------------------------------------------------------------ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.sidebar__brand img { max-height: 30px; max-width: 140px; }
.sidebar__brand strong { font-size: 1.02rem; letter-spacing: -.02em; }
.sidebar__mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: 0 0 auto;
}
.sidebar__nav { padding: .85rem .75rem; overflow-y: auto; flex: 1; }
.sidebar__group { margin: 1.1rem 0 .35rem; padding: 0 .5rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .11em; color: var(--muted); font-weight: 600; }
.sidebar__link {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-sm);
  color: var(--text); font-size: .9rem; font-weight: 500; margin-bottom: 2px;
}
.sidebar__link:hover { background: var(--surface-2); text-decoration: none; }
.sidebar__link.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar__link .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; }
.sidebar__footer { padding: .85rem 1.25rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar__search { flex: 1; max-width: 420px; position: relative; }
.topbar__search input { width: 100%; padding-right: 3.2rem; }
.topbar__search kbd {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: .7rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; background: var(--surface-2);
}
.topbar__spacer { flex: 1; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 650; font-size: .78rem;
}
.content { padding: 1.5rem; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { margin: 0; }

/* The signature element: a thin pulse rule under page titles. */
.pulse-rule { height: 3px; width: 46px; border-radius: 3px; background: linear-gradient(90deg, var(--brand), transparent); margin: .5rem 0 0; }

/* Cards ------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__head { padding: 1rem 1.15rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.card__head h2, .card__head h3 { margin: 0; }
.card__body { padding: 1.15rem; }
.card + .card { margin-top: 1.25rem; }

.grid { display: grid; gap: 1.25rem; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 1.9rem; font-weight: 680; letter-spacing: -.03em; margin-top: .25rem; }
.stat__meta { font-size: .8rem; color: var(--muted); }

/* Forms ------------------------------------------------------------------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: .35rem; }
/* `input:not([type])` matters: an input with no type attribute defaults to text but is
   NOT matched by input[type="text"], and would silently render at the browser's default
   width instead of filling its field. */
input:not([type]),
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], input[type="tel"], input[type="url"],
input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"],
select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; font-size: .92rem;
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: border-color .12s, box-shadow .12s;
}
input:not([type]):focus, input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }
input[type="file"] {
  width: 100%; padding: .45rem .6rem; font: inherit; font-size: .88rem;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); cursor: pointer;
}
input[type="file"]::file-selector-button {
  font: inherit; font-size: .82rem; font-weight: 600; margin-right: .6rem;
  padding: .3rem .65rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
input[disabled], select[disabled], textarea[disabled] {
  background: var(--surface-2); color: var(--muted); cursor: not-allowed;
}
input[type="color"] { width: 56px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
textarea { min-height: 90px; resize: vertical; }
.field__hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.field__error { font-size: .8rem; color: var(--danger); margin-top: .25rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.checkbox input { width: auto; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .52rem .9rem; font: inherit; font-size: .88rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  transition: transform .06s ease, background .12s, border-color .12s;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { background: var(--brand); filter: brightness(.94); }
.btn--danger { color: var(--danger); border-color: var(--border); }
.btn--danger:hover { background: rgba(220, 38, 38, .08); }
.btn--sm { padding: .32rem .6rem; font-size: .8rem; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 650; padding: .6rem .9rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: .7rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .col-actions { text-align: right; white-space: nowrap; }

/* Badges ------------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem;
  border-radius: 999px; font-size: .74rem; font-weight: 650; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.badge--success { color: var(--success); border-color: rgba(22, 163, 74, .3); background: rgba(22, 163, 74, .1); }
.badge--danger { color: var(--danger); border-color: rgba(220, 38, 38, .3); background: rgba(220, 38, 38, .1); }
.badge--warning { color: #B45309; border-color: rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .12); }
.badge--brand { color: var(--brand); border-color: rgba(37, 99, 235, .3); background: var(--brand-soft); }

/* Alerts ------------------------------------------------------------------ */
.alert { padding: .7rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); margin-bottom: 1rem; font-size: .9rem; }
.alert--success { border-color: rgba(22, 163, 74, .35); background: rgba(22, 163, 74, .08); }
.alert--error { border-color: rgba(220, 38, 38, .35); background: rgba(220, 38, 38, .07); }
.alert--info { border-color: rgba(37, 99, 235, .35); background: var(--brand-soft); word-break: break-all; }

/* Empty states ------------------------------------------------------------ */
.empty { padding: 2.75rem 1.5rem; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); }
.empty p { max-width: 380px; margin: 0 auto 1rem; }

/* Guest / auth ------------------------------------------------------------ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth__brand {
  background: var(--secondary, #0F172A); color: #fff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between; background-size: cover; background-position: center;
}
.auth__brand h1 { font-size: 2.3rem; max-width: 12ch; color: #fff; }
.auth__brand p { color: rgba(255, 255, 255, .78); max-width: 40ch; }
.auth__panel { display: grid; place-items: center; padding: 2rem; }
.auth__form { width: 100%; max-width: 380px; }
.auth__logo { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.75rem; }
.auth__logo img { max-height: 34px; }

/* Install ----------------------------------------------------------------- */
.install { max-width: 720px; margin: 3rem auto; padding: 0 1.25rem; }
.steps { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.steps span {
  font-size: .74rem; padding: .25rem .6rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface); text-transform: capitalize;
}
.steps span.is-current { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: 650; }
.check-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.check-row:last-child { border-bottom: 0; }

/* Landing ----------------------------------------------------------------- */
.landing__nav { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.5rem; max-width: 1120px; margin: 0 auto; }
.landing__hero { max-width: 900px; margin: 3.5rem auto 2rem; padding: 0 1.5rem; text-align: center; }
.landing__hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.035em; }
.landing__hero p { font-size: 1.08rem; color: var(--muted); max-width: 56ch; margin: 0 auto 1.75rem; }
.landing__flow { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin: 2.5rem 0; font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.landing__flow span { padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.landing__features { max-width: 1120px; margin: 0 auto 4rem; padding: 0 1.5rem; }
.plan { text-align: center; }
.plan__price { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; }

/* Utilities --------------------------------------------------------------- */
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.stack > * + * { margin-top: 1rem; }
.filters { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.pagination { display: flex; gap: .35rem; justify-content: center; padding: 1rem; }
.pagination a, .pagination span { padding: .3rem .6rem; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: .85rem; }
.pagination .is-current { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.hide-mobile { display: initial; }
.sidebar-toggle { display: none; }

@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth__brand { display: none; }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .hide-mobile { display: none; }
  .topbar { padding: .6rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Modals ------------------------------------------------------------------ */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, .45);
  display: grid; place-items: center; padding: 1rem;
}
.modal[hidden] { display: none; }
.modal__panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.35rem; width: 100%; max-width: 460px;
}
.modal__panel h2 { font-size: 1.1rem; }

/* Details/summary used for the optional half of the task form -------------- */
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '＋ '; font-weight: 600; }
details[open] summary::before { content: '－ '; }

/* Task cards on the employee dashboard ------------------------------------ */
.task-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .95rem 1.05rem; box-shadow: var(--shadow);
}
.task-card + .task-card { margin-top: .75rem; }
.task-card__title { font-weight: 620; margin-bottom: .15rem; }
.task-card__meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.task-card__actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .85rem; }
.task-card--overdue { border-left: 3px solid var(--danger); }
.task-card--review { border-left: 3px solid var(--warning); }

@media (max-width: 600px) {
  /* On a phone the employee should be able to hit any action with a thumb. */
  .task-card__actions .btn { flex: 1; min-height: 40px; }
  .modal__panel { max-width: 100%; }
}

/* Notification bell ------------------------------------------------------- */
.notif__badge {
  position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 16px; text-align: center;
}
.notif__panel {
  position: absolute; right: 0; top: calc(100% + .5rem); width: 340px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.notif__panel[hidden] { display: none; }
/* The list scrolls; the header and footer stay put so "Mark all read" and
   "See all" are always reachable however many notifications there are. */
.notif__panel [data-notif-list] { max-height: 340px; overflow-y: auto; }
.notif__head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.notif-item { display: block; padding: .6rem .75rem; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.is-unread { background: var(--brand-soft); }
.notif-item__title { font-size: .85rem; font-weight: 600; }
.notif-item__body { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.notif-item__when { font-size: .7rem; color: var(--muted); margin-top: 3px; }
.notif-item:last-of-type { border-bottom: 0; }
.notif-item.is-unread .notif-item__title::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); margin-right: 6px; vertical-align: middle;
}
.notif__all { display: block; padding: .55rem; text-align: center; font-size: .8rem; font-weight: 600; border-top: 1px solid var(--border); }

@media (max-width: 480px) {
  /* On a phone the dropdown becomes a near-full-width sheet rather than a
     340px panel hanging off the right edge. */
  .notif__panel { position: fixed; left: .5rem; right: .5rem; width: auto; top: 56px; }
}

@media (max-width: 600px) {
  .notif__panel { position: fixed; left: .5rem; right: .5rem; width: auto; top: 56px; }
}
