/* PacificHub theme: applies the new design tokens (defined in dtms.css) to the
 * existing tracker screens WITHOUT changing their layout -- colours, type,
 * radius and shadows only. Loaded after style.css, so it overrides it. */

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--ph-surface);
  color: var(--ph-text);
}

/* navigation */
.sidebar {
  background: linear-gradient(180deg, var(--ph-navy-800), var(--ph-navy-900));
}
.sidebar h2 {
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #9fb0cc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.serial-list li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #dbe5f5;
  font-size: 14px;
}
.serial-list li:hover {
  background: rgba(255, 255, 255, 0.08);
}
.serial-list li.active {
  background: linear-gradient(90deg, var(--ph-accent), #ff8a3d);
  color: #fff;
  font-weight: 600;
}
.sidebar input[type="text"] {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px !important;
}
.sidebar input[type="text"]::placeholder {
  color: #9fb0cc;
}

/* top bar and content */
.topbar {
  background: var(--ph-card);
  border-bottom: 1px solid var(--ph-line);
  box-shadow: var(--ph-shadow);
}
.user-info {
  color: var(--ph-muted);
  font-size: 13px;
}
.content {
  padding: 1.25rem 1.5rem;
}
.content h3 {
  color: var(--ph-text);
}

/* controls */
.button {
  background: var(--ph-accent);
  border-radius: 8px;
  padding: 0.45rem 0.95rem;
  font-weight: 600;
  font-family: inherit;
}
.button:hover {
  background: var(--ph-accent-dark);
}
.button:disabled {
  background: #c7d0dd;
  color: #fff;
}
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  border: 1px solid var(--ph-line);
  border-radius: 8px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(242, 106, 33, 0.35);
  border-color: var(--ph-accent);
}

/* surfaces */
.spec-panel {
  background: var(--ph-card);
  border: 1px solid var(--ph-line);
  border-radius: var(--ph-radius);
  box-shadow: var(--ph-shadow);
}
.content table {
  border-collapse: collapse;
}
.content th {
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ph-muted);
}
iframe {
  border-radius: 8px;
  border-color: var(--ph-line);
}

/* ---- main layout: sidebar navigation + photo banner ------------------------ */
@media (min-width: 701px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 240px;
  }
}
.sidebar.active {
  display: flex;
  flex-direction: column;
}
.side-brand {
  padding: 14px 14px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.sidebar .logo-image {
  display: block;
  max-width: 128px;
  margin: 4px auto 8px;
  border-radius: 14px;
}
.side-nav {
  padding: 10px 10px 4px;
  flex-shrink: 0;
}
.side-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: #cdd8ea;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  font: inherit;
  font-size: 14.5px;
  cursor: pointer;
}
.side-nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
.side-nav-item.active {
  background: linear-gradient(90deg, var(--ph-accent), #ff8a3d);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(242, 106, 33, 0.35);
}
.side-nav-item .ico {
  width: 20px;
  text-align: center;
}
.side-section {
  padding: 12px 18px 6px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8ea2c4;
  flex-shrink: 0;
}
.sidebar #serial-search {
  width: auto;
  margin: 0 12px 8px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.sidebar .serial-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.side-foot {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.side-tagline {
  font-family: "Segoe Script", "Brush Script MT", cursive;
  color: #8ea2c4;
  font-size: 14px;
  line-height: 1.25;
  margin: 0 2px 10px;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 13px;
}
.side-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ph-navy-600);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.side-user-name small {
  display: block;
  color: #9fb0cc;
  font-size: 11px;
}
.side-logout {
  margin-top: 10px;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cdd8ea;
  border-radius: 8px;
  padding: 7px;
  cursor: pointer;
  font: inherit;
}
.side-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.topbar.hero-bar {
  position: relative;
  min-height: 140px;
  padding: 22px 28px;
  color: #fff;
  border: 0;
  box-shadow: none;
  align-items: flex-start;
  background:
    linear-gradient(90deg, rgba(7, 20, 42, 0.94) 0%, rgba(11, 30, 59, 0.82) 38%, rgba(11, 30, 59, 0.1) 78%),
    url(/dtms/hero.jpg) center 64% / cover no-repeat,
    linear-gradient(120deg, var(--ph-navy-700) 0%, #26436f 55%, #c9703a 130%);
}
.hero-text h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}
.hero-text p {
  margin: 4px 0 6px;
  color: #d6e0f0;
}
.hero-bar .user-info {
  color: #aebfdc;
  font-size: 12px;
}
.hero-bar .top-left {
  display: flex;
  align-items: flex-start;
}
.hero-bell {
  background: rgba(7, 20, 42, 0.55);
  backdrop-filter: blur(4px);
}
.hero-bell:hover {
  background: rgba(7, 20, 42, 0.8);
}

@media (max-width: 700px) {
  .sidebar {
    background: linear-gradient(180deg, var(--ph-navy-800), var(--ph-navy-900));
  }
  .topbar.hero-bar {
    flex-direction: row;
    min-height: 110px;
    padding: 14px 16px;
  }
  .hero-text h1 {
    font-size: 20px;
  }
  .side-nav-item {
    width: 100%;
  }
}

/* ---- login / change-password screens --------------------------------------- */
.login-page {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
  position: relative;
  background:
    linear-gradient(180deg, rgba(7, 20, 42, 0.72) 0%, rgba(11, 30, 59, 0.55) 45%, rgba(7, 20, 42, 0.85) 100%),
    url(/dtms/hero.jpg) center 60% / cover no-repeat,
    linear-gradient(120deg, var(--ph-navy-700) 0%, #26436f 55%, #c9703a 130%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--ph-card);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(7, 20, 42, 0.45);
  padding: 28px 30px 22px;
  text-align: center;
  box-sizing: border-box;
}
.login-logo {
  max-width: 150px;
  border-radius: 14px;
  margin: 0 auto 10px;
  display: block;
}
.login-card h2 {
  margin: 6px 0 2px;
  font-size: 22px;
  color: var(--ph-text);
}
.login-sub {
  margin: 0 0 16px;
  color: var(--ph-muted);
  font-size: 13.5px;
}
.login-card label {
  font-size: 12px;
  color: var(--ph-muted);
}
.login-card input[type="text"], .login-card input[type="password"] {
  margin: 4px 0 14px;
  padding: 10px 12px;
}
.login-submit {
  width: 100%;
  padding: 11px;
  font-size: 15px;
  margin: 4px 0 0;
}
.login-error {
  color: var(--ph-red);
  margin-top: 10px;
  min-height: 1em;
  font-size: 13.5px;
}
.login-version {
  margin: 12px 0 0;
  font-size: 11.5px;
  color: var(--ph-muted);
}
.login-tagline {
  margin-top: 22px;
  font-family: "Segoe Script", "Brush Script MT", cursive;
  color: rgba(255, 255, 255, 0.85);
  font-size: 17px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

/* ---- phones and tablets ----------------------------------------------------- */
/* Tablet portrait (701-1024px): keep the navigation but slimmer. */
@media (min-width: 701px) and (max-width: 1024px) {
  .sidebar { width: 210px; }
  .content { padding: 1rem; }
  .hero-text h1 { font-size: 22px; }
}
/* Short screens: smaller logo so the boat list gets the room. */
@media (max-height: 820px) {
  .sidebar .logo-image { max-width: 86px; }
  .side-tagline { display: none; }
}
@media (max-width: 700px) {
  .hero-bar .user-info { display: none; }
  .hero-text { min-width: 0; }
  .hero-text h1 { word-break: break-word; }
  .hero-bar .top-left { min-width: 0; flex: 1; }
  #menu-btn { width: auto; padding: 0.5rem 0.8rem; margin: 0 10px 0 0; }
  .content { padding: 0.9rem; }
  /* comfortable touch targets, and 16px text so phones don't zoom into fields */
  .button, .side-nav-item, .serial-list li { min-height: 44px; }
  .button { display: inline-flex; align-items: center; justify-content: center; }
  input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], select, textarea { font-size: 16px; }
  .sidebar { width: 84%; max-width: 320px; }
}
/* any device with a finger: bigger tap targets */
@media (pointer: coarse) {
  .button, .side-nav-item { min-height: 42px; }
  .serial-list li { padding-top: 0.75rem; padding-bottom: 0.75rem; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
}

/* ---- phone: compact banner, scrolling admin menu ---------------------------- */
.spec-panel { box-sizing: border-box; }
@media (max-width: 700px) {
  .topbar.hero-bar { min-height: 88px; padding: 12px 14px; }
  .hero-text h1 { font-size: 17px; }
  .hero-text p { font-size: 12.5px; margin: 2px 0 0; }
  .hero-bell { min-height: 40px; }
  /* the admin button strip scrolls sideways instead of stacking 6 rows high */
  .admin-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.9rem 0.8rem !important;
    padding: 2px 0.9rem 8px;
    scrollbar-width: thin;
  }
  .admin-nav .button { flex: none; margin: 0; white-space: nowrap; }
  .spec-panel { float: none !important; width: 100% !important; max-width: none !important; margin: 0 0 1rem 0 !important; }
}

/* ---- CNC file rows: long file names wrap instead of being squeezed ---------- */
.cnc-row { flex-wrap: wrap; }
.cnc-name { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.cnc-row input[type="checkbox"] { width: 24px; height: 24px; flex: none; }
@media (max-width: 700px) {
  .cnc-who { flex: 1 0 100%; padding-left: 32px; }
}

@media (max-width: 700px) {
  /* flatten the admin menu's row groups so every button joins one scrolling strip */
  .admin-nav > div, .admin-nav > div > div { display: contents !important; }
}

/* settings hub cards */
.settings-card-btn {
  background: var(--ph-card) !important;
  color: var(--ph-text) !important;
  border: 1px solid var(--ph-line) !important;
  box-shadow: var(--ph-shadow);
  border-radius: var(--ph-radius) !important;
  font-weight: normal;
  display: block !important;
}
.settings-card-btn:hover { border-color: var(--ph-accent) !important; }
.settings-card-btn strong { color: var(--ph-text); }

/* ---- QC checklist: Yes / No / N/A as big tap targets in one row -------------- */
.qc-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.qc-options label {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 !important; padding: 8px 14px;
  border: 1px solid var(--ph-line); border-radius: 10px; background: #fff; cursor: pointer;
}
.qc-options label:has(input:checked) { border-color: var(--ph-accent); background: var(--ph-accent-soft); font-weight: 600; }
.qc-options input[type="radio"] { width: 20px; height: 20px; margin: 0; }
@media (max-width: 700px) {
  .qc-options { flex-wrap: nowrap; gap: 6px; }
  .qc-options label { flex: 1 1 0; min-width: 0; justify-content: center; min-height: 46px; padding: 8px 4px; }
}
@media (pointer: coarse) {
  .qc-options label { min-height: 46px; }
}

/* ---- production dashboard, rework page, TV screen manager -------------------- */
.dash h2 { margin: 0; font-size: 22px; }
.dash-sub { margin: 2px 0 0; color: var(--ph-muted); font-size: 13px; }
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dash-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dash-tools select, .dash-tools input[type="text"] { width: auto; margin: 0; padding: 7px 10px; }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.dash-card { background: var(--ph-card); border: 1px solid var(--ph-line); border-radius: var(--ph-radius); box-shadow: var(--ph-shadow); padding: 12px 14px; text-align: left; cursor: pointer; font: inherit; color: var(--ph-text); }
.dash-card b { display: block; font-size: 28px; line-height: 1.1; }
.dash-card span { color: var(--ph-muted); font-size: 12.5px; }
.dash-card.bad { border-bottom: 4px solid var(--ph-red); } .dash-card.bad b { color: var(--ph-red); }
.dash-card.warn { border-bottom: 4px solid #e0a000; }
.dash-card.good { border-bottom: 4px solid var(--ph-green); }
.dash-group { background: var(--ph-card); border: 1px solid var(--ph-line); border-radius: var(--ph-radius); margin-bottom: 8px; padding: 0 14px; }
.dash-group summary { cursor: pointer; padding: 11px 0; display: flex; align-items: center; gap: 10px; font-size: 15px; }
.dash-list { list-style: none; margin: 0; padding: 0 0 8px; }
.dash-list li { padding: 7px 0; border-top: 1px solid #f0f3f8; font-size: 14px; }
.dash-list.boxed { background: var(--ph-card); border: 1px solid var(--ph-line); border-radius: var(--ph-radius); padding: 0 14px; }
.dash-list a { color: var(--ph-navy-700); text-decoration: none; } .dash-list a:hover { color: var(--ph-accent-dark); text-decoration: underline; }
.dash-list .bay { display: inline-block; min-width: 46px; }
.dim { color: var(--ph-muted); font-size: 12.5px; }
.pill { background: #e9eef6; color: #3b4d6b; border-radius: 10px; padding: 1px 9px; font-size: 12px; margin-left: auto; }
.pill.ok { background: var(--ph-green-soft); color: var(--ph-green); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.05em; padding: 1px 7px; border-radius: 5px; }
.tag.on { background: var(--ph-green-soft); color: var(--ph-green); }
.tag.rect { background: var(--ph-amber-soft); color: var(--ph-amber); }
.tag.late { background: var(--ph-red-soft); color: var(--ph-red); }
.dash-empty { background: var(--ph-card); border: 1px dashed var(--ph-line); border-radius: var(--ph-radius); padding: 30px; text-align: center; color: var(--ph-muted); }
.dash-empty b { color: var(--ph-text); }
.dash-table { width: 100%; border-collapse: collapse; background: var(--ph-card); border-radius: var(--ph-radius); }
.dash-table th, .dash-table td { padding: 8px 10px; border-bottom: 1px solid #f0f3f8; text-align: left; vertical-align: top; font-size: 14px; }
.dash-table select { width: auto; margin: 0; padding: 5px 8px; }
.dash-overlay { position: fixed; inset: 0; background: rgba(7, 20, 42, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 10px; z-index: 1000; overflow-y: auto; }
.dash-modal { background: #fff; border-radius: 14px; width: 100%; max-width: 620px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(7, 20, 42, 0.4); }
.dash-modal h3 { margin: 0 0 10px; }
.dash-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.dash-form .full { grid-column: 1 / -1; }
.dash-form label { display: block; font-size: 12px; color: var(--ph-muted); margin-bottom: 2px; }
.dash-form input[type="text"], .dash-form input[type="date"], .dash-form input[type="number"], .dash-form select, .dash-form textarea { width: 100%; margin: 0; }
.dash-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.dash-err { color: var(--ph-red); margin-top: 6px; }
.dash-toast { position: fixed; bottom: 20px; right: 20px; background: var(--ph-navy-800); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 1100; }
.dash-tv { background: var(--ph-card); border: 1px solid var(--ph-line); border-radius: var(--ph-radius); box-shadow: var(--ph-shadow); padding: 14px 16px; margin-bottom: 14px; }
.dash-tv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.dash-tv-head .tv-name { width: auto; flex: 1 1 200px; margin: 0; font-weight: 700; }
.dash-tv-url { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.dash-tv-url .tv-url { flex: 1 1 260px; margin: 0; font-size: 12px; }
.tv-slide-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.tv-slide-row span { flex: 1; }
.tv-slide-row .button { margin: 0; min-height: 0; }
.dash-help { padding: 0 0 12px; font-size: 13.5px; }
.dash-help pre { background: #0b1e3b; color: #dbe5f5; padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
@media (max-width: 700px) {
  .dash-form { grid-template-columns: 1fr; }
  .dash-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-card b { font-size: 24px; }
  .dash-tools { width: 100%; }
}

.dash-h3 { margin: 18px 0 8px; font-size: 15px; color: var(--ph-muted); text-transform: uppercase; letter-spacing: 0.05em; }
