/* IES Portal. Mobile first; the sidebar layout starts at 900px. */

:root {
  --lime: #78da00;
  --lime-dark: #5fae00;
  --lime-soft: #eef9df;
  --ink: #171717;
  --ink-2: #373636;
  --steel: #58adc9;
  --steel-soft: #e4f2f7;
  --white: #ffffff;
  --bg: #f6f6f6;
  --line: #e2e2e2;
  --muted: #6b6a6a;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --warn: #9a6400;
  --warn-soft: #fff4dc;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(23, 23, 23, 0.06), 0 2px 8px rgba(23, 23, 23, 0.05);
  --tap: 44px;
  --topbar-h: 56px;
  --tabbar-h: 64px;
  --sidebar-w: 260px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

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

html,
body {
  margin: 0;
}

body {
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
  font-weight: 900;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: #2f86a4;
}

img {
  max-width: 100%;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.nowrap {
  white-space: nowrap;
}

.break {
  overflow-wrap: anywhere;
}

.prewrap {
  white-space: pre-wrap;
}

.sr-only,
.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  background: var(--lime);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

:focus-visible {
  outline: 3px solid var(--steel);
  outline-offset: 2px;
}

/* ---------- brand ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  text-decoration: none;
  min-height: var(--tap);
}

.brand-mark {
  width: 56px;
  height: auto;
  display: block;
}

.wordmark,
.login-wordmark {
  display: flex;
  flex-direction: column;
  text-transform: uppercase;
  line-height: 1.05;
}

.wm-top {
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: var(--white);
}

.wm-bottom {
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--lime);
}

.brand-compact .brand-mark {
  width: 42px;
}

.brand-compact .wm-top {
  font-size: 0.9rem;
}

.brand-compact .wm-bottom {
  font-size: 0.58rem;
}

.tagline {
  color: #a9a9a9;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  margin: 6px 0 0;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn .icon {
  width: 20px;
  height: 20px;
}

.btn-primary {
  background: var(--lime);
  color: var(--ink);
}

.btn-primary:hover {
  background: #86e61a;
}

.btn-primary:active {
  background: var(--lime-dark);
}

.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border-color: #cfcfcf;
}

.btn-secondary:hover {
  border-color: var(--ink-2);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border-color: currentColor;
  color: inherit;
}

.btn-ghost-dark {
  background: transparent;
  color: var(--white);
  border-color: #4a4a4a;
}

.btn-ghost-dark:hover {
  border-color: var(--lime);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-lg {
  min-height: 52px;
  padding: 12px 22px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.link {
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}

/* ---------- forms ---------- */

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

fieldset.field {
  border: 0;
  padding: 0;
}

.field label,
.field legend {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0;
}

.field-row {
  display: grid;
  gap: 16px;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='tel'],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid #cfcfcf;
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* prevents zoom on iOS */
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(88, 173, 201, 0.25);
}

input:disabled {
  background: #efefef;
  color: var(--muted);
}

textarea {
  resize: vertical;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  cursor: pointer;
  font-weight: 400 !important;
}

.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--lime-dark);
  flex: none;
  margin: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.segmented {
  display: flex;
  border: 1px solid #cfcfcf;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
}

.segmented label {
  flex: 1;
  position: relative;
  font-weight: 700;
}

.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 8px 12px;
  cursor: pointer;
}

.segmented input:checked + span {
  background: var(--ink);
  color: var(--lime);
}

.segmented input:focus-visible + span {
  outline: 3px solid var(--steel);
  outline-offset: -3px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 140px;
  padding: 20px;
  border: 2px dashed #bdbdbd;
  border-radius: var(--radius);
  background: #fbfbfb;
  text-align: center;
  cursor: pointer;
  font-weight: 700 !important;
}

.dropzone .icon {
  width: 32px;
  height: 32px;
  color: var(--lime-dark);
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--lime-dark);
  background: var(--lime-soft);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--lime-dark);
  background: var(--lime-soft);
}

.dropzone-sm {
  min-height: 96px;
}

.dropzone-text {
  overflow-wrap: anywhere;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  margin-bottom: 4px;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f3c2c2;
}

/* ---------- flash ---------- */

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 8px 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--white);
  border-left: 5px solid var(--lime);
  box-shadow: var(--shadow);
  transition: opacity 0.3s;
}

.flash p {
  margin: 0;
  font-weight: 700;
}

.flash-error {
  border-left-color: var(--danger);
}

.flash-sticky {
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top) + 8px);
  z-index: 15;
  border: 2px solid var(--lime);
  border-left-width: 5px;
}

.flash-body {
  flex: 1;
  min-width: 0;
}

.flash-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: var(--tap);
  height: var(--tap);
  margin: -8px 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.flash.is-hidden {
  opacity: 0;
}

.secret {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.secret code {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  background: var(--ink);
  color: var(--lime);
  border-radius: var(--radius-sm);
  user-select: all;
}

/* ---------- login ---------- */

.layout-login {
  background: var(--ink);
  background-image: radial-gradient(ellipse at top, #262626 0%, var(--ink) 60%);
  color: var(--white);
}

.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(20px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(20px + var(--safe-left));
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

.login-mark {
  width: 120px;
  height: auto;
  margin-bottom: 14px;
}

.login-wordmark {
  align-items: center;
  margin: 0;
}

.login-wordmark .wm-top {
  font-size: 1.6rem;
  letter-spacing: 0.12em;
}

.login-wordmark .wm-bottom {
  font-size: 0.82rem;
  letter-spacing: 0.24em;
  margin-top: 2px;
}

.login-tagline {
  margin: 12px 0 0;
  color: #a9a9a9;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-title {
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 18px;
  color: #e6e6e6;
}

.login-form .field label {
  color: #d6d6d6;
}

.login-form input[type='email'],
.login-form input[type='password'] {
  background: #222;
  border-color: #444;
  color: var(--white);
  min-height: 50px;
}

.login-form input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(120, 218, 0, 0.25);
}

.login-form .check {
  color: #d6d6d6;
}

.login-form .btn {
  margin-top: 4px;
}

.layout-login .alert-error {
  background: #3a1616;
  border-color: #6b2525;
  color: #ffb4b4;
}

.login-help {
  margin-top: 22px;
  text-align: center;
  color: #bdbdbd;
  font-size: 0.95rem;
}

.login-help a,
.layout-login .error-page a:not(.btn) {
  color: var(--lime);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.login-foot {
  margin-top: 32px;
  color: #777;
  font-size: 0.8rem;
}

.layout-login .error-page p {
  color: #cfcfcf;
}

/* ---------- app shell (mobile) ---------- */

.layout-app {
  padding-top: calc(var(--topbar-h) + var(--safe-top));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(8px + var(--safe-right)) 0 calc(14px + var(--safe-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  border-bottom: 3px solid var(--lime);
}

.topbar-action {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  color: var(--white);
  border-radius: 50%;
}

.sidebar {
  display: none;
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--ink);
  border-top: 1px solid #2c2c2c;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tap);
  color: #a9a9a9;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
}

.tab.is-active {
  color: var(--lime);
}

.tab.is-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 28%;
  right: 28%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--lime);
}

.content {
  padding: 18px calc(16px + var(--safe-right)) 28px calc(16px + var(--safe-left));
}

.page {
  max-width: 1200px;
  margin: 0 auto;
}

.narrow {
  max-width: 720px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.page-header > div:first-child {
  min-width: 0;
  flex: 1 1 180px;
}

.page-header h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.page-sub {
  margin: 4px 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--lime-dark);
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  margin-bottom: 4px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.crumb .icon {
  width: 18px;
  height: 18px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  min-width: 0;
}

.card > h2:first-child {
  margin-bottom: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card-head h2 {
  margin: 0;
}

.card-danger {
  border: 1px solid #f3c2c2;
}

.card-danger h2 {
  color: var(--danger);
}

.section {
  margin-top: 8px;
}

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 24px 0 10px;
}

.grid-2 {
  display: grid;
  gap: 0 16px;
}

.grid-side {
  display: grid;
  gap: 16px;
}

/* ---------- search ---------- */

.search {
  position: relative;
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search input[type='search'] {
  min-height: 54px;
  padding-left: 46px;
  font-size: 17px;
  border-radius: var(--radius);
  border: 2px solid #d6d6d6;
  box-shadow: var(--shadow);
}

.search input[type='search']:focus {
  border-color: var(--lime-dark);
  box-shadow: 0 0 0 4px rgba(120, 218, 0, 0.2);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search .btn {
  min-height: 54px;
  border-radius: var(--radius);
  display: none;
}

/* ---------- chips ---------- */

.chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

.chip-label {
  flex: none;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  width: 38px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 4px;
  margin-right: calc(-16px - var(--safe-right));
  padding-right: 16px;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid #d6d6d6;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
}

.chip-n {
  color: var(--muted);
  font-weight: 400;
}

.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--lime);
}

.chip.is-on .chip-n {
  color: #bdbdbd;
}

/* ---------- manuals ---------- */

.file-badge {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--lime);
}

.file-image {
  background: var(--steel-soft);
  color: #22708a;
}

.file-word {
  background: #e6edfa;
  color: #2b579a;
}

.file-excel {
  background: #e3f3e9;
  color: #1d6f42;
}

.file-text,
.file-file {
  background: #ececec;
  color: var(--ink-2);
}

.manual-cards {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 10px;
}

.manual-card {
  display: flex;
  align-items: stretch;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.manual-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  min-height: 76px;
}

.manual-card-main .file-badge {
  margin-top: 2px;
}

.manual-card-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.manual-card-text strong {
  font-size: 1.02rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.manual-card-text .muted {
  font-size: 0.9rem;
}

.manual-card-open {
  flex: none;
  flex-direction: column;
  gap: 2px;
  min-width: 76px;
  border-radius: 0;
  font-size: 0.85rem;
}

.tag {
  justify-self: start;
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--steel-soft);
  color: #22708a;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tags .tag {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.manual-table {
  display: none;
}

.table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin-top: 8px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid #efefef;
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #fafdf5;
}

.table-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.table-title:hover span:last-child {
  text-decoration: underline;
}

.table .actions {
  text-align: right;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.detail {
  display: grid;
  gap: 0 20px;
}

.open-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.preview {
  display: none;
}

.preview iframe {
  width: 100%;
  height: 78vh;
  min-height: 560px;
  border: 0;
  border-radius: var(--radius);
  background: #525659;
  box-shadow: var(--shadow);
  display: block;
  margin-bottom: 16px;
}

.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
}

.meta dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.meta dd {
  margin: 0;
  font-weight: 700;
  min-width: 0;
}

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mini-list li + li {
  border-top: 1px solid #efefef;
}

.mini-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 0;
  color: inherit;
  text-decoration: none;
}

.mini-text {
  display: grid;
  min-width: 0;
  flex: 1;
}

.mini-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-text .muted {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-chev {
  color: #bdbdbd;
}

/* ---------- dashboard ---------- */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  border-bottom: 4px solid var(--lime);
}

.stat-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #2a2a2a;
  color: var(--lime);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

.stat-label {
  color: #bdbdbd;
  font-size: 0.85rem;
  font-weight: 700;
}

.module-grid {
  display: grid;
  gap: 12px;
}

.module-tile {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px dashed #cfcfcf;
  color: inherit;
  text-decoration: none;
}

.module-tile:hover {
  border-color: var(--lime-dark);
}

.module-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--lime-soft);
  color: var(--lime-dark);
}

.module-body {
  display: grid;
  gap: 4px;
}

.module-title {
  font-weight: 900;
}

.module-desc {
  color: var(--muted);
  font-size: 0.92rem;
}

.soon {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--steel-soft);
  color: #22708a;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.empty {
  text-align: center;
  padding: 40px 16px;
  max-width: 520px;
  margin: 0 auto;
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--lime-soft);
  color: var(--lime-dark);
  margin-bottom: 14px;
}

.empty-icon .icon {
  width: 36px;
  height: 36px;
}

.coming-soon .soon {
  margin: 0 0 10px;
}

.error-code {
  font-size: 3rem;
  font-weight: 900;
  color: var(--lime);
  margin: 0;
  line-height: 1;
}

/* ---------- More page / link lists ---------- */

.more-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.more-user > div {
  display: grid;
  min-width: 0;
}

.more-user .muted {
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--lime);
  font-weight: 900;
}

.link-list {
  list-style: none;
  padding: 0 4px;
}

.link-list li + li {
  border-top: 1px solid #efefef;
}

.link-list a,
.link-list button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.link-list a > span:not(.soon),
.link-list button > span {
  flex: 1;
}

.link-list .icon:first-child {
  color: var(--lime-dark);
}

.chev {
  color: #bdbdbd;
}

/* ---------- admin lists ---------- */

.row-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.row-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 14px 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

a.row-card {
  flex-wrap: nowrap;
}

.row-card-text {
  flex: 1 1 220px;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.row-card-meta {
  display: none;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #ececec;
  color: var(--ink-2);
  font-size: 0.76rem;
  font-weight: 700;
}

.badge-staff {
  background: var(--ink);
  color: var(--lime);
}

.badge-customer {
  background: var(--steel-soft);
  color: #22708a;
}

.badge-off {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 6px 14px 6px 8px;
  border: 1px solid #d6d6d6;
  border-radius: 999px;
  background: var(--white);
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--ink);
}

.switch-track {
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #cfcfcf;
  transition: background-color 0.15s;
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}

.switch.is-on .switch-track {
  background: var(--lime-dark);
}

.switch.is-on .switch-knob {
  transform: translateX(16px);
}

/* ---------- portal ---------- */

.layout-portal {
  background: var(--bg);
}

.portal-header {
  background: var(--ink);
  border-bottom: 3px solid var(--lime);
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
}

.portal-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 64px;
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-user-name {
  display: none;
  color: #d6d6d6;
  font-weight: 700;
  margin-right: 6px;
}

.portal-user .btn span {
  display: none;
}

.portal-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px calc(16px + var(--safe-right)) 32px calc(16px + var(--safe-left));
}

.portal-hero {
  margin-bottom: 20px;
}

.portal-hero h1 {
  font-size: 1.8rem;
}

.portal-grid {
  display: grid;
  gap: 0 20px;
}

.site-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-list li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}

.site-list li + li {
  border-top: 1px solid #efefef;
}

.site-list .icon {
  color: var(--lime-dark);
  margin-top: 2px;
}

.site-list li > span {
  display: grid;
}

.card-feature .module-icon {
  margin-bottom: 12px;
}

.card-call {
  background: var(--ink);
  color: var(--white);
}

.card-call p {
  color: #cfcfcf;
}

.portal-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 20px 16px calc(28px + var(--safe-bottom));
}

.portal-footer p {
  margin: 0 0 4px;
}

.portal-inactive {
  padding-top: 56px;
}

/* ---------- small phones ---------- */

@media (max-width: 380px) {
  .wordmark .wm-bottom {
    letter-spacing: 0.1em;
  }

  .open-actions {
    grid-template-columns: 1fr;
  }
}

/* ---------- tablets ---------- */

@media (min-width: 600px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }

  .search .btn {
    display: inline-flex;
  }

  .module-grid {
    grid-template-columns: 1fr 1fr;
  }

  .portal-user-name,
  .portal-user .btn span {
    display: inline;
  }

  .row-card-meta {
    display: block;
  }

  .content {
    padding: 24px calc(24px + var(--safe-right)) 32px calc(24px + var(--safe-left));
  }

  .chips {
    margin-right: 0;
    padding-right: 2px;
    flex-wrap: wrap;
    overflow: visible;
  }
}

/* ---------- desktop ---------- */

@media (min-width: 900px) {
  h1 {
    font-size: 1.9rem;
  }

  .layout-app {
    padding: 0 0 0 calc(var(--sidebar-w) + var(--safe-left));
  }

  .topbar,
  .tabbar {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: calc(var(--sidebar-w) + var(--safe-left));
    display: flex;
    flex-direction: column;
    padding: 22px 14px 18px calc(14px + var(--safe-left));
    background: var(--ink);
    color: var(--white);
    overflow-y: auto;
    z-index: 20;
  }

  .sidebar > .brand,
  .sidebar > .tagline {
    padding: 0 8px;
  }

  .side-nav {
    display: grid;
    gap: 2px;
    margin-top: 26px;
  }

  .side-heading {
    margin: 18px 12px 6px;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8a8a8a;
  }

  .side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: var(--tap);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 0;
    border-left: 3px solid transparent;
    background: none;
    color: #d6d6d6;
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
  }

  .side-link span:not(.soon) {
    flex: 1;
  }

  .side-link .icon {
    color: #8a8a8a;
  }

  .side-link:hover {
    background: #222;
    color: var(--white);
  }

  .side-link.is-active {
    background: #262626;
    color: var(--white);
    border-left-color: var(--lime);
  }

  .side-link.is-active .icon {
    color: var(--lime);
  }

  .side-link .soon {
    background: #2a2a2a;
    color: #9fd3e4;
  }

  .side-user {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #2c2c2c;
  }

  .side-user-info {
    display: grid;
    padding: 4px 12px 8px;
  }

  .side-user-info span {
    color: var(--lime);
    font-size: 0.8rem;
    font-weight: 700;
  }

  .side-link-sm {
    min-height: 38px;
    font-size: 0.88rem;
  }

  .content {
    padding: 32px 40px 48px;
  }

  .flash-sticky {
    top: 16px;
  }

  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .grid-side {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .module-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .module-tile {
    flex-direction: column;
  }

  .search-hero {
    max-width: 760px;
  }

  .manual-cards {
    display: none;
  }

  .manual-table {
    display: block;
  }

  .detail {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }

  .open-actions {
    display: flex;
  }

  .preview {
    display: block;
  }

  .portal-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
  }

  .portal-hero h1 {
    font-size: 2.2rem;
  }
}

/* ---------- customer detail / sites ---------- */

.customer-badges {
  align-items: center;
  gap: 8px;
  margin: -6px 0 8px;
}

.customer-badges .toggles {
  margin-left: auto;
}

.section-title-first {
  margin-top: 8px;
}

.row-card-link {
  color: var(--ink);
  text-decoration: none;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.row-card-link:hover strong {
  text-decoration: underline;
}

.badge-link {
  text-decoration: none;
}

.badge-link:hover {
  background: #dedede;
}

.row-card-icon {
  color: var(--lime-dark);
  align-self: flex-start;
  margin-top: 2px;
}

.site-notes {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}

.toggles .btn-sm {
  min-height: var(--tap);
}

@media (max-width: 599px) {
  .customer-badges .toggles {
    margin-left: 0;
    width: 100%;
  }
}
