/* Care Systems IT Asset Register - v1.1.0 (2026-09-23)
   1.1.0: pills for spare / to_return / disposed / not recorded, form groups, long-text wrapping */
:root {
  --cs-purple: #723287; --cs-purple-tint: #F6F2F9;
  --cs-red: #C32451; --cs-red-tint: #FAE9EE;
  --cs-grey: #515565; --cs-grey-tint: #F1F1F4;
  --cs-teal: #1991A7; --cs-teal-tint: #E8F4F6;
  --cs-yellow: #E9B530; --cs-yellow-tint: #FBF0D4;
  --cs-white: #FFFFFF; --cs-border: #E2E2E8;
  --cs-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cs-radius-sm: 8px; --cs-radius: 16px;
  --cs-shadow: 0rem 0.2rem 0.7rem 0rem rgba(0, 0, 0, 0.1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--cs-font); font-weight: 400; color: var(--cs-grey); background: var(--cs-grey-tint); line-height: 1.5; font-size: 16px; }
h1, h2, h3 { color: #2b2d36; line-height: 1.25; margin: 0 0 16px; font-weight: 600; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1rem; }
a { color: var(--cs-purple); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: #7a7e8c; font-weight: 300; }
.small { font-size: 0.875rem; }

/* Header */
.topbar { background: var(--cs-white); box-shadow: var(--cs-shadow); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand img { height: 32px; width: auto; }
.brand span { font-weight: 600; color: var(--cs-purple); border-left: 1px solid var(--cs-border); padding-left: 12px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { text-decoration: none; color: var(--cs-grey); padding: 8px 12px; border-radius: var(--cs-radius-sm); font-weight: 500; }
.nav a:hover { background: var(--cs-grey-tint); }
.nav a.active { background: var(--cs-purple-tint); color: var(--cs-purple); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 0.875rem; }

main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; }

/* Panels */
.panel { background: var(--cs-white); border-radius: var(--cs-radius); box-shadow: var(--cs-shadow); padding: 24px; margin-bottom: 24px; }
.grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.two-col { display: grid; gap: 24px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Asset cards */
.asset-card { background: var(--cs-white); border-radius: var(--cs-radius); box-shadow: var(--cs-shadow); padding: 24px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 12px; border: 2px solid transparent; transition: border-color .15s; }
.asset-card:hover, .asset-card:focus-visible { border-color: var(--cs-purple); outline: none; }
.asset-card .cat { font-size: 0.75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--cs-purple); }
.asset-card .title { font-size: 1.125rem; font-weight: 600; color: #2b2d36; }
.asset-card .meta { display: flex; flex-wrap: wrap; gap: 8px; }
.asset-card .row { display: flex; justify-content: space-between; font-size: 0.875rem; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; background: var(--cs-grey-tint); color: var(--cs-grey); white-space: nowrap; }
.pill.active, .pill.good { background: var(--cs-teal-tint); color: #11707f; }
.pill.pending, .pill.fair, .pill.in_repair { background: var(--cs-yellow-tint); color: #8a6508; }
.pill.poor, .pill.faulty, .pill.lost, .pill.issue { background: var(--cs-red-tint); color: var(--cs-red); }
.pill.returned, .pill.retired, .pill.disposed { background: var(--cs-grey-tint); color: var(--cs-grey); }
.pill.spare { background: var(--cs-purple-tint); color: var(--cs-purple); }
.pill.to_return { background: var(--cs-yellow-tint); color: #8a6508; }
.pill.none { background: transparent; color: var(--cs-grey); border: 1px dashed currentColor; font-weight: 500; }
.pill.internal { background: var(--cs-purple-tint); color: var(--cs-purple); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px; border-radius: var(--cs-radius-sm); border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--cs-purple); color: var(--cs-white); }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--cs-white); color: var(--cs-purple); border-color: var(--cs-purple); }
.btn.ghost { background: transparent; color: var(--cs-grey); border-color: var(--cs-border); }
.btn.danger { background: var(--cs-white); color: var(--cs-red); border-color: var(--cs-red); }
.btn.sm { padding: 8px 12px; font-size: 0.875rem; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Forms */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.875rem; font-weight: 600; color: #2b2d36; }
label.field .hint { font-weight: 300; color: #7a7e8c; }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 12px; border: 1px solid var(--cs-border); border-radius: var(--cs-radius-sm); background: var(--cs-white); font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cs-purple); outline-offset: 0; border-color: var(--cs-purple); }
textarea { min-height: 96px; resize: vertical; }
input:disabled, select:disabled { background: var(--cs-grey-tint); color: #7a7e8c; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--cs-purple); }

/* Detail list */
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; margin: 0; }
dl.details dt { font-size: 0.875rem; font-weight: 600; color: #7a7e8c; }
dl.details dd { margin: 0; color: #2b2d36; word-break: break-word; }

/* Notes */
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.note { border-left: 4px solid var(--cs-border); padding: 8px 16px; background: var(--cs-white); }
.note.issue { border-left-color: var(--cs-red); background: var(--cs-red-tint); border-radius: 0 var(--cs-radius-sm) var(--cs-radius-sm) 0; }
.note.system { border-left-color: var(--cs-teal); }
.note.internal { border-left-color: var(--cs-purple); background: var(--cs-purple-tint); border-radius: 0 var(--cs-radius-sm) var(--cs-radius-sm) 0; }
.note .who { font-size: 0.75rem; color: #7a7e8c; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note .body { white-space: pre-wrap; margin-top: 4px; color: #2b2d36; word-break: break-word; }

/* Callouts */
.callout { padding: 12px 16px; border-radius: var(--cs-radius-sm); border-left: 4px solid; margin-bottom: 16px; }
.callout.note { background: var(--cs-yellow-tint); border-color: var(--cs-yellow); }
.callout.ok { background: var(--cs-teal-tint); border-color: var(--cs-teal); }
.callout.err { background: var(--cs-red-tint); border-color: var(--cs-red); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; font-weight: 600; color: #7a7e8c; padding: 12px; border-bottom: 1px solid var(--cs-border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--cs-grey-tint); vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--cs-purple-tint); }

/* Stats */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 24px; }
.stat { background: var(--cs-white); border-radius: var(--cs-radius); box-shadow: var(--cs-shadow); padding: 16px 24px; text-decoration: none; color: inherit; border: 2px solid transparent; }
.stat:hover { border-color: var(--cs-purple); }
.stat .n { font-size: 1.75rem; font-weight: 700; color: #2b2d36; }
.stat .l { font-size: 0.875rem; }
.stat.warn .n { color: var(--cs-red); }
.stat.attn .n { color: #8a6508; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.filters select { width: auto; }

/* Empty + login */
.empty { text-align: center; padding: 48px 24px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--cs-purple-tint); }
.login-card { background: var(--cs-white); border-radius: var(--cs-radius); box-shadow: var(--cs-shadow); padding: 48px 40px; max-width: 440px; width: 100%; text-align: center; }
.login-card img { height: 40px; margin-bottom: 32px; }
.login-card h1 { font-size: 1.5rem; }
.ms-btn { width: 100%; margin-top: 24px; }

.toast { position: fixed; bottom: 24px; right: 24px; z-index: 50; max-width: 400px; box-shadow: var(--cs-shadow); }
.back { display: inline-flex; gap: 4px; align-items: center; font-size: 0.875rem; text-decoration: none; margin-bottom: 16px; font-weight: 500; }

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .brand span { display: none; }
  main { padding: 24px 16px 48px; }
  .panel, .asset-card { padding: 16px; }
  dl.details { grid-template-columns: 1fr; gap: 4px; }
  dl.details dd { margin-bottom: 8px; }
}
.text-left { text-align: left; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-0 { margin-bottom: 0; }

/* Form groups and long text (v1.1.0) */
fieldset.group { border: 1px solid var(--cs-grey-tint); border-radius: 12px; padding: 16px; margin: 0 0 16px; min-width: 0; }
fieldset.group legend { font-weight: 600; padding: 0 8px; }
.form textarea[name="model"], .form textarea[name="serial_number"] { min-height: 3em; }
.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
td.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
