:root {
  --red: #bd171d;
  --red-dark: #8e1016;
  --red-soft: #fff1f1;
  --ink: #1c252d;
  --muted: #69737c;
  --line: #dfe4e8;
  --surface: #ffffff;
  --canvas: #f4f6f7;
  --navy: #17232d;
  --green: #17795d;
  --amber: #a26309;
  --blue: #2766a3;
  --shadow: 0 18px 46px rgba(20, 29, 35, 0.09);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); font-family: "DM Sans", Arial, sans-serif; font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.eyebrow { color: var(--red); font: 700 0.76rem/1 "Manrope", sans-serif; letter-spacing: 0.13em; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(400px, 0.95fr) minmax(460px, 1.05fr); background: #fff; }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px 60px; color: white; background: linear-gradient(145deg, #111b23 0%, #26333d 100%); }
.brand-panel { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; }
.brand-panel p { margin: 0; padding-left: 18px; border-left: 1px solid rgba(255,255,255,.25); color: #bec6cb; font-size: .9rem; }
.brand-logo { display: block; width: 210px; height: auto; object-fit: contain; }
.brand-logo-login { width: 220px; border-radius: 5px; }
.brand-copy { position: relative; z-index: 1; max-width: 560px; margin: auto 0 24px; }
.brand-copy .eyebrow { color: #f1a3a6; }
.brand-copy h1 { max-width: 540px; margin: 18px 0; font: 800 clamp(2.7rem, 4.4vw, 5.2rem)/1.03 "Manrope", sans-serif; letter-spacing: -.055em; }
.brand-copy p { max-width: 480px; margin: 0; color: #cdd3d7; font-size: 1.1rem; }
.grid-accent { position: absolute; right: -110px; bottom: -120px; width: 520px; height: 520px; transform: rotate(18deg); opacity: .19; background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px); background-size: 38px 38px; }
.grid-accent::after { content: ""; position: absolute; inset: 88px; background: var(--red); opacity: .7; clip-path: polygon(10% 0, 100% 18%, 78% 100%, 0 78%); }
.login-area { display: grid; place-items: center; padding: 48px; background: radial-gradient(circle at 100% 0%, #fff4f4 0, transparent 35%), #fff; }
.login-card { width: min(430px, 100%); }
.mobile-logo { display: none; }
.login-card h2 { margin: 14px 0 4px; font: 800 2.25rem/1.15 "Manrope", sans-serif; letter-spacing: -.035em; }
.subtle { margin: 0 0 34px; color: var(--muted); }
.login-card label, .field label { display: block; margin: 18px 0 7px; font-weight: 600; font-size: .9rem; }
.field label { margin-top: 0; }
.field label b { color: var(--red); }
input, select, textarea { width: 100%; border: 1px solid #cfd6db; border-radius: 8px; background: #fff; color: var(--ink); padding: 12px 13px; outline: none; transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(189, 23, 29, .1); }
textarea { resize: vertical; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 68px; }
.text-button { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); border: 0; background: transparent; color: var(--red); font-weight: 700; font-size: .85rem; }
.primary-button, .secondary-button, .danger-button, .logout-button { border-radius: 8px; padding: 11px 17px; border: 1px solid transparent; font-weight: 700; transition: transform .15s, background .15s, border-color .15s; }
.primary-button { color: white; background: var(--red); box-shadow: 0 8px 18px rgba(189,23,29,.18); }
.primary-button:hover { background: var(--red-dark); transform: translateY(-1px); }
.primary-button.full { width: 100%; margin-top: 6px; padding-block: 13px; }
.secondary-button { color: var(--ink); background: #fff; border-color: var(--line); }
.secondary-button:hover { border-color: #aeb7be; background: #fafbfb; }
.danger-button { background: var(--red); color: white; }
.form-message { min-height: 24px; margin: 10px 0 0; font-size: .88rem; }
.error { color: #b1181e; }
.login-footnote { margin: 22px 0 0; text-align: center; color: #8a9298; font-size: .78rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px 22px; background: var(--navy); color: #fff; }
.sidebar-logo { height: 72px; display: grid; place-items: center; margin: 0 7px 32px; border-radius: 7px; background: #fff; }
.sidebar-logo .brand-logo { width: 190px; max-width: calc(100% - 18px); }
.sidebar nav { flex: 1; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-left: 3px solid transparent; color: #fff; text-align: left; font-weight: 700; cursor: default; }
.nav-item.active { border-left-color: var(--red); background: transparent; }
.nav-icon { font-size: 1.25rem; }
.sidebar-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-top: 20px; }
.signed-in { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--red); font-weight: 800; }
.signed-in strong, .signed-in small { display: block; }
.signed-in strong { font-size: .88rem; }
.signed-in small { color: #aeb8bf; font-size: .74rem; }
.logout-button { width: 100%; color: #d9dfe3; background: transparent; border-color: rgba(255,255,255,.15); }
.logout-button:hover { background: rgba(255,255,255,.08); }
.main-content { min-width: 0; padding: 38px clamp(24px, 4vw, 62px) 64px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.page-header h1 { margin: 9px 0 1px; font: 800 clamp(2rem, 4vw, 3.1rem)/1.05 "Manrope", sans-serif; letter-spacing: -.045em; }
.page-header p { margin: 7px 0 0; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric-card { position: relative; overflow: hidden; min-height: 142px; padding: 20px 21px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 5px 20px rgba(20,29,35,.035); }
.metric-card::before { content: ""; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: #8b979f; }
.metric-card.stock::before { background: var(--green); }
.metric-card.assigned::before { background: var(--blue); }
.metric-card.repair::before { background: var(--amber); }
.metric-label { display: block; color: var(--muted); font-weight: 600; font-size: .88rem; }
.metric-card strong { display: block; margin: 4px 0 -1px; font: 800 2.35rem/1.2 "Manrope", sans-serif; }
.metric-card small { color: #8a949b; }
.register-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.register-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px 17px; }
.register-heading h2 { margin: 0; font: 800 1.25rem/1.2 "Manrope", sans-serif; }
.register-heading p { margin: 3px 0 0; color: var(--muted); font-size: .85rem; }
.toolbar { display: grid; grid-template-columns: minmax(250px, 1fr) repeat(3, minmax(145px, auto)); gap: 10px; padding: 0 24px 20px; }
.toolbar select, .search-box input { padding-block: 10px; font-size: .9rem; }
.search-box { position: relative; }
.search-box span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #7b858d; font-size: 1.25rem; }
.search-box input { padding-left: 39px; }
.table-wrap { min-height: 250px; overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 1120px; }
th, td { padding: 15px 16px; text-align: left; border-bottom: 1px solid #edf0f2; vertical-align: middle; }
th { color: #6d777f; background: #fafbfb; font-size: .76rem; text-transform: uppercase; letter-spacing: .055em; }
.actions-heading { text-align: right; }
td { font-size: .9rem; }
tbody tr:hover { background: #fcfdfd; }
.asset-name strong, .asset-name small { display: block; }
.asset-name small { color: var(--muted); margin-top: 2px; }
.serial { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; color: #4f5b64; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 999px; font-weight: 700; font-size: .78rem; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-in-stock { color: var(--green); background: #e9f6f1; }
.status-assigned { color: var(--blue); background: #edf4fb; }
.status-under-repair { color: var(--amber); background: #fff6e7; }
.status-retired { color: #69737c; background: #eef1f3; }
.employee strong, .employee small { display: block; }
.employee small { color: var(--muted); }
.actions { display: flex; justify-content: flex-end; gap: 6px; }
.action-button { min-width: 58px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #55616a; font-size: .7rem; font-weight: 700; line-height: 1; transition: border-color .15s, background .15s, color .15s, transform .15s; }
.action-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-button:hover { border-color: #aeb7be; background: #f7f9fa; color: var(--red); transform: translateY(-1px); }
.action-button.view-action { color: var(--blue); }
.action-button.delete-action { color: #a92227; }
.action-button:focus-visible { outline: 3px solid rgba(189,23,29,.18); outline-offset: 2px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #55616a; font-size: 1.25rem; }
.icon-button:hover { border-color: var(--line); background: #fff; color: var(--red); }
.empty-state { text-align: center; padding: 52px 24px 58px; }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 13px; background: var(--red-soft); color: var(--red); font-size: 1.6rem; }
.empty-state h3 { margin: 0; font: 800 1.15rem/1.3 "Manrope", sans-serif; }
.empty-state p { margin: 6px 0 18px; color: var(--muted); }

dialog { border: 0; padding: 0; color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgba(15,22,27,.28); }
dialog::backdrop { background: rgba(13,20,25,.62); backdrop-filter: blur(3px); }
.asset-dialog { width: min(760px, calc(100% - 28px)); max-height: 92vh; border-radius: 13px; }
.asset-dialog form { padding: 26px; }
.view-dialog-content { padding: 26px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.dialog-header h2 { margin: 8px 0 0; font: 800 1.7rem/1.2 "Manrope", sans-serif; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.field.span-2 { grid-column: span 2; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.detail-item { min-width: 0; padding: 14px 15px; border: 1px solid var(--line); border-radius: 9px; background: #fafbfb; }
.detail-item.wide { grid-column: span 2; }
.detail-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.detail-value { display: block; overflow-wrap: anywhere; color: var(--ink); font-weight: 600; white-space: pre-wrap; }
.detail-value.serial-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.confirm-dialog { width: min(430px, calc(100% - 28px)); border-radius: 13px; padding: 30px; text-align: center; }
.danger-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; color: var(--red); background: var(--red-soft); font-weight: 800; font-size: 1.4rem; }
.confirm-dialog h2 { margin: 0; font: 800 1.45rem/1.25 "Manrope", sans-serif; }
.confirm-dialog p { color: var(--muted); }
.confirm-dialog .dialog-actions { justify-content: center; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 360px; padding: 13px 17px; border-radius: 9px; color: white; background: #17232d; box-shadow: 0 14px 38px rgba(0,0,0,.22); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error-toast { background: #9c171c; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: span 2; }
}
@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-area { min-height: 100vh; padding: 28px; }
  .mobile-logo { display: block; margin-bottom: 36px; }
  .mobile-logo .brand-logo { width: 225px; max-width: 100%; }
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 18px; }
  .sidebar-logo { width: 152px; height: 55px; margin: 0 auto 0 0; }
  .sidebar-logo .brand-logo { width: 135px; }
  .sidebar nav, .signed-in { display: none; }
  .sidebar-bottom { border: 0; padding: 0; }
  .logout-button { width: auto; }
  .main-content { padding: 26px 18px 48px; }
}
@media (max-width: 620px) {
  .page-header { align-items: stretch; flex-direction: column; }
  .page-header .primary-button { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 124px; padding: 16px; }
  .metric-card strong { font-size: 2rem; }
  .register-heading { align-items: stretch; flex-direction: column; }
  .toolbar { grid-template-columns: 1fr; padding-inline: 16px; }
  .search-box { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .details-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: auto; }
  .asset-dialog form { padding: 20px; }
  .view-dialog-content { padding: 20px; }
}
