/* ============================================================
   York Industries Methods Tracker — Stylesheet
   ============================================================ */

/* --- CSS Variables (light mode) --- */
:root {
  --bg:          #f4f6f8;
  --panel:       #ffffff;
  --text:        #15202b;
  --muted:       #64748b;
  --line:        #d8dee8;
  --accent:      #b91c1c;   /* York red */
  --accent-dark: #991b1b;
  --green:       #166534;
  --red:         #991b1b;
  --yellow:      #92400e;
  --purple:      #7c3aed;
  --blue:        #1e40af;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .2s, color .2s;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
  background: #0f172a;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  height: 42px;
  width: auto;
  object-fit: contain;
}
.header-title {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}
.header-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.clock-wrap {
  text-align: right;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}

/* ============================================================
   NAV
   ============================================================ */
nav {
  display: flex;
  gap: 6px;
  padding: 10px 22px;
  background: #e8edf5;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
}
.tab-btn {
  padding: 9px 14px;
  border-radius: 9px;
  border: 0;
  color: #1f2937;
  font-weight: 800;
  font-size: 13px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab-btn:hover,
.tab-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ============================================================
   MAIN / LAYOUT
   ============================================================ */
main {
  padding: 22px 24px 48px;
  max-width: 1600px;
  margin: 0 auto;
}
h1 {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 900;
}
h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(15,23,42,.06);
  padding: 18px;
  margin-bottom: 18px;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.home-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.card .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.card .value {
  font-size: 30px;
  font-weight: 900;
  margin-top: 6px;
  color: var(--accent);
}

/* ============================================================
   HOME TAB TABLES
   ============================================================ */
.home-tables {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}
.form-grid .full {
  grid-column: 1 / -1;
}
label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
input, select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  transition: border-color .15s;
}
input:focus, select:focus {
  outline: 2px solid rgba(185,28,28,.2);
  border-color: var(--accent);
}
input.invalid, select.invalid {
  border-color: var(--red);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  border: 0;
  border-radius: 9px;
  padding: 9px 14px;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
  white-space: nowrap;
}
.btn.primary   { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.secondary { background: #e2e8f0; color: #172033; }
.btn.secondary:hover { background: #cbd5e1; }
.btn.danger    { background: #fee2e2; color: var(--red); }
.btn.danger:hover  { background: #fecaca; }
.btn.save      { background: #dcfce7; color: var(--green); }
.btn.save:hover    { background: #bbf7d0; }
.btn.cancel    { background: #f1f5f9; color: #475569; }
.btn:disabled  { opacity: .45; cursor: not-allowed; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow: auto;
  max-height: 66vh;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  background: var(--panel);
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}
th {
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  position: sticky;
  top: 0;
  z-index: 2;
}
tr:hover td { background: #f8fbff; }
tr.selected td { background: #dbeafe !important; outline: 2px solid #60a5fa; }
td.center { text-align: center; }
td.action-cell { white-space: nowrap; }
.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}
.edit-field {
  padding: 5px 8px;
  font-size: 13px;
  min-width: 90px;
}

/* ============================================================
   STATUS PILLS  (all values from the app)
   ============================================================ */
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.status-in-progress       { background: #dbeafe; color: #1e40af; }
.status-waiting-for-check { background: #fef9c3; color: #854d0e; }
.status-waiting           { background: #fef9c3; color: #854d0e; }
.status-on-hold           { background: #fee2e2; color: #991b1b; }
.status-completed         { background: #dcfce7; color: #166534; }
.status-not-started       { background: #f1f5f9; color: #475569; }
.status-yes               { background: #dcfce7; color: #166534; }
.status-no                { background: #fee2e2; color: #991b1b; }

/* ============================================================
   NOTE / NOTICE
   ============================================================ */
.note {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
  font-style: italic;
}

/* ============================================================
   TOAST
   ============================================================ */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  z-index: 999;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  max-width: 340px;
}
#toast.show    { opacity: 1; }
#toast.success { background: #166534; color: #fff; }
#toast.error   { background: #991b1b; color: #fff; }

/* ============================================================
   DARK THEME
   ============================================================ */
body.dark {
  --bg:    #0f172a;
  --panel: #1e293b;
  --text:  #e2e8f0;
  --muted: #94a3b8;
  --line:  #334155;
}
body.dark nav         { background: #1e293b; border-color: var(--line); }
body.dark .tab-btn    { color: #cbd5e1; }
body.dark input,
body.dark select      { background: #0f172a; color: #e2e8f0; border-color: #475569; }
body.dark th          { background: #0f172a; color: #94a3b8; }
body.dark tr:hover td { background: #1e3a5f; }
body.dark .card       { background: #1e293b; }
body.dark label       { color: #94a3b8; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .form-grid            { grid-template-columns: repeat(3, 1fr); }
  .home-grid            { grid-template-columns: repeat(2, 1fr); }
  .two-col              { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .form-grid            { grid-template-columns: 1fr 1fr; }
  .home-grid            { grid-template-columns: 1fr 1fr; }
  header                { flex-direction: column; align-items: flex-start; gap: 10px; }
  th                    { position: static; }
}
@media (max-width: 480px) {
  .form-grid            { grid-template-columns: 1fr; }
  .home-grid            { grid-template-columns: 1fr; }
}
