/* =========================================================
   TechCare PC Service — main.css
   Shared design tokens, layout shell, and UI primitives.
   ========================================================= */

:root{
  /* --- Color tokens --- */
  --bg:            #EEF1ED;
  --surface:       #FFFFFF;
  --surface-2:     #F5F7F3;
  --ink:           #16241F;
  --ink-soft:      #4C5A53;
  --ink-faint:     #8A968F;
  --line:          #DCE1DB;
  --line-strong:   #C4CBC3;

  --primary:       #1B4B43;
  --primary-dark:  #10322C;
  --primary-soft:  #DCEAE5;

  --accent:        #E07B1D;
  --accent-dark:   #B8620F;
  --accent-soft:   #FBE7D2;

  --success:       #2F7A4F;
  --success-soft:  #DFF0E4;
  --warn:          #B4790E;
  --warn-soft:     #FBEBCF;
  --danger:        #B3432B;
  --danger-soft:   #F7E1DB;

  /* --- Type --- */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  /* --- Layout --- */
  --sidebar-w: 236px;
  --topbar-h: 64px;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --shadow-card: 0 1px 2px rgba(16,50,44,0.06), 0 6px 20px -8px rgba(16,50,44,0.12);
  --shadow-pop: 0 12px 32px -8px rgba(16,50,44,0.28);
}

*, *::before, *::after{ box-sizing: border-box; }
html{ -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}
img{ max-width:100%; display:block; }
a{ color: inherit; text-decoration:none; }
ul{ list-style:none; margin:0; padding:0; }
button{ font-family: inherit; cursor:pointer; }
input, select, textarea{ font-family: inherit; }

h1,h2,h3,h4{
  font-family: var(--font-display);
  color: var(--primary-dark);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.mono{ font-family: var(--font-mono); }

/* =========================================================
   APP SHELL
   ========================================================= */
.app-shell{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar{
  background: var(--primary-dark);
  color: #DCEAE5;
  padding: 22px 16px 20px;
  display:flex;
  flex-direction:column;
  gap: 22px;
  position: sticky;
  top:0;
  height:100vh;
  overflow-y:auto;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 0 6px;
}
.brand-mark{
  width:34px; height:34px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-dark) 100%);
  display:flex; align-items:center; justify-content:center;
  color:#1C1000;
  font-family: var(--font-mono);
  font-weight:700;
  font-size: 13px;
  flex-shrink:0;
}
.brand-name{
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  color: #F3F7F1;
  line-height:1.15;
}
.brand-sub{
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #8FB3A8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-group-label{
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6F9186;
  padding: 0 10px;
  margin-bottom: 6px;
}
.nav-list{ display:flex; flex-direction:column; gap:2px; }
.nav-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 9px 10px;
  border-radius: var(--radius-s);
  color: #C7DCD4;
  font-size: 13.6px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
  border-left: 3px solid transparent;
}
.nav-link svg{ width:17px; height:17px; opacity:.85; flex-shrink:0; }
.nav-link:hover{ background: rgba(255,255,255,0.06); color:#fff; }
.nav-link.active{
  background: rgba(224,123,29,0.16);
  color: #FFDDB0;
  border-left-color: var(--accent);
}

.sidebar-foot{
  margin-top:auto;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
  font-size: 11.5px;
  color: #6F9186;
  padding-left: 10px;
  line-height:1.6;
}

/* --- Topbar --- */
.topbar{
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top:0;
  z-index: 20;
}
.page-title{
  font-family: var(--font-display);
  font-size: 19px;
  font-weight:700;
  color: var(--primary-dark);
}
.page-eyebrow{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topbar-right{ display:flex; align-items:center; gap:14px; }
.menu-toggle{
  display:none;
  background:none; border:none; color: var(--primary-dark);
  padding:6px;
}
.user-chip{
  display:flex; align-items:center; gap:9px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.user-avatar{
  width:26px; height:26px; border-radius:50%;
  background: var(--primary);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-family:var(--font-mono); font-weight:700;
}
.user-chip-name{ font-size:12.5px; font-weight:600; color: var(--ink); }

main{ padding: 26px 28px 48px; max-width: 1240px; }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  padding: 9px 16px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:active{ transform: translateY(1px); }
.btn svg{ width:15px; height:15px; }

.btn-primary{ background: var(--primary); color:#fff; }
.btn-primary:hover{ background: var(--primary-dark); }

.btn-accent{ background: var(--accent); color:#291600; }
.btn-accent:hover{ background: var(--accent-dark); color:#fff; }

.btn-ghost{ background: transparent; color: var(--primary-dark); border-color: var(--line-strong); }
.btn-ghost:hover{ background: var(--surface-2); }

.btn-danger-ghost{ background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn-danger-ghost:hover{ background: var(--danger-soft); }

.btn-sm{ padding: 6px 11px; font-size: 12.5px; }
.btn-icon{ padding: 8px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* =========================================================
   CARDS / SURFACES
   ========================================================= */
.card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-card);
}
.card-pad{ padding: 20px 22px; }
.card-head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3{ font-size:15.5px; margin:0; }
.card-head-sub{ font-size:12px; color: var(--ink-faint); margin-top:2px; font-family: var(--font-mono); }

/* =========================================================
   BADGES / STATUS PILLS
   ========================================================= */
.badge{
  display:inline-flex; align-items:center; gap:5px;
  padding: 3.5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.badge::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge-success{ background: var(--success-soft); color: var(--success); }
.badge-warn{ background: var(--warn-soft); color: var(--warn); }
.badge-danger{ background: var(--danger-soft); color: var(--danger); }
.badge-neutral{ background: var(--surface-2); color: var(--ink-soft); border:1px solid var(--line); }
.badge-info{ background: var(--primary-soft); color: var(--primary); }

/* =========================================================
   TABLES
   ========================================================= */
.table-wrap{ overflow-x:auto; }
table.data-table{
  width:100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th{
  text-align:left;
  font-family: var(--font-mono);
  font-size: 10.8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table tbody td{
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tbody tr:last-child td{ border-bottom:none; }
.data-table tbody tr:hover{ background: var(--surface-2); }
.cell-strong{ font-weight:700; color: var(--ink); }
.cell-mono{ font-family: var(--font-mono); font-size:12.8px; color: var(--ink-soft); }
.row-actions{ display:flex; gap:6px; justify-content:flex-end; }
.link-btn{ background:none; border:none; color: var(--primary); font-weight:600; padding:4px 6px; font-size:13.3px; }
.link-btn:hover{ text-decoration: underline; }

/* =========================================================
   FORMS
   ========================================================= */
.field{ display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
.field label{ font-size:12.5px; font-weight:600; color: var(--ink-soft); }
.field .hint{ font-size:11px; color: var(--ink-faint); }
.field input, .field select, .field textarea{
  padding: 9px 11px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  width:100%;
}
.field input:focus, .field select:focus, .field textarea:focus{
  border-color: var(--primary);
}
.field textarea{ resize: vertical; min-height: 70px; }
.field-row{ display:grid; grid-template-columns: 1fr 1fr; gap:14px; }

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state{
  padding: 44px 20px;
  text-align:center;
  color: var(--ink-faint);
}
.empty-state .es-icon{ font-family: var(--font-mono); font-size: 26px; color: var(--line-strong); margin-bottom:10px;}
.empty-state h4{ color: var(--ink-soft); margin-bottom:4px; }
.empty-state p{ font-size:12.8px; margin:0 0 14px; }

/* =========================================================
   MODAL
   ========================================================= */
.modal-backdrop{
  position:fixed; inset:0;
  background: rgba(16,36,31,0.45);
  display:none;
  align-items:flex-start; justify-content:center;
  padding: 6vh 20px;
  z-index: 100;
  overflow-y:auto;
}
.modal-backdrop.open{ display:flex; }
.modal{
  background: var(--surface);
  border-radius: var(--radius-l);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-pop);
  animation: modal-in .16s ease;
}
@keyframes modal-in{ from{ opacity:0; transform: translateY(8px);} to{opacity:1; transform:translateY(0);} }
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3{ margin:0; font-size:16.5px; }
.modal-close{ background:none; border:none; color: var(--ink-faint); font-size:20px; line-height:1; padding:4px; }
.modal-body{ padding: 20px 22px; max-height: 62vh; overflow-y:auto; }
.modal-foot{
  display:flex; justify-content:flex-end; gap:10px;
  padding: 16px 22px; border-top:1px solid var(--line);
}

/* =========================================================
   STAT CARD (dashboard)
   ========================================================= */
.stat-card{
  padding: 18px 20px;
  display:flex; flex-direction:column; gap:8px;
}
.stat-top{ display:flex; align-items:center; justify-content:space-between; }
.stat-label{ font-size:12px; color: var(--ink-faint); font-weight:600; }
.stat-icon{
  width:30px; height:30px; border-radius:8px;
  display:flex; align-items:center; justify-content:center;
  color: var(--primary);
  background: var(--primary-soft);
}
.stat-icon svg{ width:16px; height:16px; }
.stat-value{ font-family: var(--font-display); font-size: 27px; font-weight:700; color: var(--primary-dark); }
.stat-foot{ font-size:11.5px; color: var(--ink-faint); }
.stat-foot.up{ color: var(--success); }
.stat-foot.warn-txt{ color: var(--warn); }

/* =========================================================
   SERVICE / REPAIR TAG — signature component
   Styled after a physical workshop repair tag: perforated
   stub edge on the left, rotated status stamp on the right.
   ========================================================= */
.repair-tag{
  position:relative;
  display:flex;
  gap:18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 16px 20px 16px 26px;
  overflow:hidden;
}
.repair-tag::before{
  content:'';
  position:absolute; left:0; top:0; bottom:0; width:0;
  border-left: 2px dashed var(--line-strong);
}
.repair-tag::after{
  content:'';
  position:absolute; left:-6px; top:0; bottom:0; width:12px;
  background-image: radial-gradient(circle, var(--bg) 3px, transparent 3.2px);
  background-size: 12px 16px;
  background-position: center;
}
.tag-id{ font-family: var(--font-mono); font-size:11px; color: var(--ink-faint); }
.tag-main{ flex:1; min-width:0; }
.tag-title{ font-weight:700; font-size:14.5px; color:var(--ink); margin-bottom:2px; }
.tag-meta{ font-size:12.3px; color: var(--ink-soft); }
.tag-stamp{
  align-self:center;
  border: 2px solid currentColor;
  border-radius: 6px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-weight:700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  flex-shrink:0;
}
.tag-stamp.st-done{ color: var(--success); }
.tag-stamp.st-progress{ color: var(--warn); }
.tag-stamp.st-diagnosed{ color: var(--danger); }

/* =========================================================
   TOAST
   ========================================================= */
.toast{
  position: fixed; bottom: 22px; right: 22px;
  background: var(--primary-dark); color:#fff;
  padding: 12px 18px; border-radius: var(--radius-s);
  font-size: 13px; box-shadow: var(--shadow-pop);
  transform: translateY(20px); opacity:0; pointer-events:none;
  transition: all .22s ease;
  z-index: 200;
  display:flex; align-items:center; gap:8px;
}
.toast.show{ transform: translateY(0); opacity:1; }
.toast::before{ content:'●'; color: var(--accent); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px){
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed; left:0; top:0; bottom:0; z-index: 90;
    transform: translateX(-100%);
    transition: transform .2s ease;
    width: 240px;
  }
  .sidebar.open{ transform: translateX(0); box-shadow: var(--shadow-pop); }
  .menu-toggle{ display:flex; align-items:center; justify-content:center; }
  main{ padding: 20px 16px 40px; }
  .field-row{ grid-template-columns: 1fr; }
  .topbar{ padding: 0 16px; }
}

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

@media print{
  .sidebar, .topbar, .no-print{ display:none !important; }
  .app-shell{ display:block; }
  main{ padding:0; max-width:none; }
  body{ background:#fff; }
}
