* { box-sizing: border-box; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

body {
  margin: 0;
  color: #1e2a32;
  background: linear-gradient(135deg, #e6edf5 0%, #f0f4f8 40%, #dbe7f1 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(90deg, #0b3d5c 0%, #135a85 100%);
  color: #fff; position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap; gap: 8px;
  box-shadow: 0 2px 8px rgba(11,61,92,0.25);
}
.brand { display: flex; align-items: center; gap: 15px; }
.logo { height: 40px; background: #fff; padding: 4px; border-radius: 6px; }
.topbar h1 { font-size: 1.1rem; margin: 0; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.actions button, .save-bar button, .data-table button {
  cursor: pointer; border: 1px solid #c8d2da; background: #fff; color: #0b3d5c;
  padding: 7px 13px; border-radius: 6px; font-size: 0.9rem; font-weight: 600;
  transition: background 0.15s ease, transform 0.05s ease, filter 0.15s ease;
}
.actions button:hover { filter: brightness(0.95); }
.actions button:active { transform: scale(0.97); }

/* Colorful Topbar Action Buttons */
.actions button.btn-new {
  background: #16a34a;
  border-color: #15803d;
  color: #ffffff;
}
.actions button.btn-new:hover {
  background: #15803d;
}

.actions button.btn-saved {
  background: #eab308;
  border-color: #ca8a04;
  color: #1e293b;
}
.actions button.btn-saved:hover {
  background: #ca8a04;
}

.actions button.btn-print {
  background: #ec4899;
  border-color: #db2777;
  color: #ffffff;
}
.actions button.btn-print:hover {
  background: #db2777;
}

.actions button.btn-logout {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
}
.actions button.btn-logout:hover {
  background: #b91c1c;
}

.save-bar button.primary { background: #0b8a4f; color: #fff; border-color: #0b8a4f; }
.save-bar button.primary:hover { background: #096f40; }

main { max-width: 1200px; margin: 24px auto; padding: 0 16px; }
.hidden { display: none !important; }

.card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(11,61,92,0.07);
  border: 1px solid rgba(200, 210, 218, 0.5);
}
.card h2 {
  font-size: 1rem; margin: 0 0 12px; color: #0b3d5c;
  border-bottom: 1px solid #e2e8ee; padding-bottom: 6px;
}

label { display: flex; flex-direction: column; font-size: 0.85rem; color: #45535e; gap: 4px; margin-bottom: 10px; }
input, select { padding: 8px; border: 1px solid #c8d2da; border-radius: 6px; font-size: 0.9rem; background: #fff; }
input:focus, select:focus { outline: 2px solid #0b8a4f33; border-color: #0b8a4f; }
.readonly-input { background-color: #eef3f7; color: #6b7a86; cursor: not-allowed; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
@media (max-width: 760px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td { border: 1px solid #e2e8ee; padding: 6px 8px; text-align: left; vertical-align: top; }
.data-table th { background: #eef3f8; font-weight: 600; }
.data-table input { width: 100%; border: none; padding: 6px 4px; font-size: 0.9rem; background: transparent; touch-action: manipulation; }
.data-table input:focus { outline: 1px solid #0b8a4f; background: #f7fbf8; }

.status-cell { color: #6b7a86; font-style: italic; }
.status-exchanged { color: #b35300; font-weight: 600; font-style: normal; }
.status-unchanged { color: #0b8a4f; }

.gcu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; font-size: 0.85rem; }
.instruction { font-size: 0.8rem; color: #6b7a86; margin-top: -8px; margin-bottom: 12px; }

.save-bar { display: flex; align-items: center; gap: 12px; margin: 20px 0 40px; }
#saveMsg { color: #0b8a4f; font-size: 0.9rem; }
.gcu-select { width: 100%; padding: 4px; font-size: 0.85rem; border: none; background: transparent; }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-logo { max-width: 140px; margin: 0 auto 12px; display: block; }
.login-card h2 { border: none; font-size: 1.2rem; margin-bottom: 16px; }
.login-card label { text-align: left; }
.login-msg { color: #b00020; font-size: 0.85rem; min-height: 1.2em; margin-top: 10px; }

/* ---------- HEADER LINKS ---------- */
.btn-link {
  display: inline-block; text-decoration: none; color: #0b3d5c; background: #fff;
  border: 1px solid #c8d2da; padding: 7px 13px; border-radius: 6px; font-size: 0.9rem; font-weight: 600;
}
.btn-link:hover { background: #e8eef3; }

/* ---------- ADMIN ---------- */
#newIsAdmin { padding: 8px; border-radius: 6px; border: 1px solid #c8d2da; }

/* ---------- CUSTOM DROPDOWN (CRITICAL FOR TABLETS) ---------- */
.custom-dropdown {
  display: none;
  position: fixed;
  background: #fff;
  border: 1px solid #0b3d5c;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(11, 61, 92, 0.22);
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 10000;
}
.custom-dropdown-item {
  padding: 12px 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 1px solid #f0f4f8;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.custom-dropdown-item:last-child {
  border-bottom: none;
}
.custom-dropdown-item:hover, .custom-dropdown-item:active {
  background: #e1effa;
}

/* ---------- PRINT ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  main { max-width: none; margin: 0; padding: 0; }
  .no-print, .actions, .save-bar, .instruction { display: none !important; }
  .print-only { display: block; margin-bottom: 20px; }
  .print-header h2 { margin: 0; padding-top: 10px; font-size: 1.2rem; color: #0b3d5c; }

  .card { box-shadow: none; border: none; padding: 0; margin-bottom: 24px; page-break-inside: avoid; background: transparent; }
  .card h2 { border-bottom: 2px solid #000; color: #000; margin-bottom: 8px; }
  .grid-3, .grid-2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }

  label { font-size: 0.8rem; font-weight: bold; color: #000; margin-bottom: 15px; }
  input, select { border: none; border-bottom: 1px solid #000; border-radius: 0; padding: 2px 0; font-size: 0.9rem; background: transparent; appearance: none; }
  .readonly-input { border: none; background: transparent; }

  .data-table th, .data-table td { border: 1px solid #000; color: #000; padding: 4px; font-size: 0.85rem; }
  .data-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .data-table input { border: none; padding: 0; }

  .gcu-grid { grid-template-columns: 1fr 1fr; border: 1px solid #000; padding: 10px; }
}
