/*
 * Tecaudex Workspace design system.
 * Tokens lifted from the reference design: Inter at 15px, near-black ink on white,
 * a single crimson accent, pill controls, and 11px uppercase micro-labels.
 */

:root {
  --accent: #ed1a3b;
  --accent-ink: #ffffff;
  --accent-wash: #fff1f3;

  --ink: #201e1d;
  --ink-strong: #1b1b1b;
  --ink-mid: #4c4c4c;
  --ink-muted: #939393;

  --ground: #ffffff;
  --surface: #ffffff;
  --surface-sunk: #fafafa;
  --chip: #f1f1f1;
  --line: #ebebeb;
  --line-strong: #dcdcdc;

  --ok: #157347;
  --ok-wash: #e8f5ee;
  --warn: #9a6700;
  --warn-wash: #fff6e0;

  --radius: 10px;
  --radius-lg: 14px;
  --pill: 999px;

  --shell-pad: 2rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* Micro-typography ---------------------------------------------------------- */

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow--quiet { color: var(--ink-muted); }

.muted { color: var(--ink-muted); }
.tiny { font-size: 11px; }

.display {
  margin: 0;
  font-size: clamp(1.9rem, 1.2rem + 2vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Shell --------------------------------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem var(--shell-pad);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.masthead__crumb {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.masthead__spacer { flex: 1; }

.masthead__search {
  flex: 0 1 26rem;
  min-width: 0;
}

.masthead__right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

/* The signed-in user chip */
.whoami {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}

.whoami__name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.whoami__role { color: var(--ink-muted); font-size: 11px; line-height: 1.2; }

.main {
  padding: 2rem var(--shell-pad) 4rem;
}

.main--wide { max-width: 78rem; margin: 0 inline; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

/* Avatars ------------------------------------------------------------------- */

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink-strong);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.avatar--lg { width: 36px; height: 36px; font-size: 11px; }
.avatar--accent { background: var(--accent); }

/* Controls ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;

  &:hover { border-color: var(--ink-muted); }
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);

  &:hover { filter: brightness(1.06); border-color: var(--accent); }
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-mid);

  &:hover { background: var(--chip); border-color: transparent; }
}

.btn--sm { padding: 0.3rem 0.7rem; font-size: 11.5px; }
.btn--block { width: 100%; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-mid);
  cursor: pointer;

  &:hover { background: var(--chip); }
}

.icon-btn__dot {
  position: absolute;
  transform: translate(9px, -9px);
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
}

.field-inline { position: relative; }

input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;

  &::placeholder { color: var(--ink-muted); }

  &:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
  }
}

/* Chips and badges ---------------------------------------------------------- */

.chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--pill);
  background: var(--chip);
  color: var(--ink-mid);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chip--ok { background: var(--ok-wash); color: var(--ok); }
.chip--warn { background: var(--warn-wash); color: var(--warn); }
.chip--accent { background: var(--accent-wash); color: var(--accent); }

/* Stat tiles ---------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.stat {
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.stat--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);

  & .stat__label { color: rgb(255 255 255 / 78%); }
}

.stat__value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat__label {
  margin-top: 0.15rem;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Data table ---------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  padding: 0 0.75rem 0.6rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 120ms ease;

  &:hover { background: var(--surface-sunk); }
}

.table td:first-child,
.table th:first-child { padding-left: 0; }

.table td:last-child,
.table th:last-child { padding-right: 0; text-align: right; }

.identity {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.identity__name { font-weight: 600; }

.identity__sub {
  color: var(--ink-muted);
  font-size: 11px;
}

.row-actions {
  display: inline-flex;
  gap: 0.35rem;
  justify-content: flex-end;
}

/* Module cards -------------------------------------------------------------- */

.modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.85rem;
}

.module {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease;

  &:hover { border-color: var(--ink-muted); transform: translateY(-1px); }
}

.module__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 0.35rem;
  border-radius: 9px;
  background: var(--ink-strong);
  color: #fff;
}

.module__name { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; }

.module__blurb {
  color: var(--ink-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.module__cue {
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Home layout --------------------------------------------------------------- */

.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

@media (width >= 62rem) {
  .home { grid-template-columns: minmax(0, 1fr) 21rem; }
}

.panel {
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel + .panel { margin-top: 0.85rem; }

.panel--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.panel__label {
  margin: 0 0 0.6rem;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel--accent .panel__label { color: rgb(255 255 255 / 78%); }

.feed { display: flex; flex-direction: column; gap: 0.85rem; }

.feed__item { display: flex; gap: 0.65rem; align-items: flex-start; }

.feed__body { min-width: 0; font-size: 12.5px; line-height: 1.4; }

.feed__time { color: var(--ink-muted); font-size: 11px; }

.meter {
  height: 6px;
  margin: 0.5rem 0 0.4rem;
  border-radius: var(--pill);
  background: var(--chip);
  overflow: hidden;
}

.meter__fill { height: 100%; background: var(--accent); }

/* Flashes ------------------------------------------------------------------- */

.flashes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 var(--shell-pad);

  &:not(:empty) { padding-top: 1rem; }
}

.flash {
  padding: 0.6rem 0.95rem;
  border-radius: var(--radius);
  font-size: 13px;
  animation: rise 160ms ease-out;
}

.flash--notice { background: var(--ok-wash); color: var(--ok); }
.flash--alert { background: var(--accent-wash); color: var(--accent); }

@keyframes rise {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.table tbody tr { animation: rise 200ms ease-out; }

@media (prefers-reduced-motion: reduce) {
  .flash, .table tbody tr, .module { animation: none; transition: none; }
}

/* Auth ---------------------------------------------------------------------- */

.auth {
  max-width: 23rem;
  margin: 4rem auto;
}

.auth__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.auth__form input { border-radius: var(--radius); }

.field { display: flex; flex-direction: column; gap: 0.3rem; }

.field label {
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;

  & label { text-transform: none; letter-spacing: normal; font-size: 13px; color: var(--ink); }
  & input { width: auto; }
}

.field__hint { margin: 0; color: var(--ink-muted); font-size: 11px; }

.auth__links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.25rem;
  font-size: 12.5px;
}

.errors {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 12.5px;
}

.errors__title { margin: 0; font-size: 12.5px; }
.errors__list { margin: 0.3rem 0 0; padding-left: 1.1rem; }

/* Empty state --------------------------------------------------------------- */

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}
