* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: #f3f5f8; color: #1d2430; font-size: 14px; }
.hidden { display: none !important; }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1b2a41, #324a5f); }
.login-card { background: #fff; padding: 32px; border-radius: 10px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.login-card h1 { font-size: 20px; color: #1b2a41; }
.login-card .subtitle { color: #6b7280; margin: 4px 0 20px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.hint { font-size: 12px; color: #6b7280; font-weight: normal; }

/* Forms */
input, select, textarea { padding: 8px 10px; border: 1px solid #cfd6e0; border-radius: 6px; font-size: 14px; width: 100%; font-family: inherit; }
textarea { min-height: 70px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }

/* Buttons */
.btn { padding: 8px 14px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; background: #e5e9f0; color: #1d2430; }
.btn:hover { opacity: .9; }
.btn-primary { background: #1b2a41; color: #fff; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-sos { background: #c0392b; color: #fff; font-weight: 700; padding: 14px 24px; font-size: 16px; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #1b2a41; color: #dfe6ef; display: flex; flex-direction: column; flex-shrink: 0; }
.brand { padding: 18px; font-weight: 700; font-size: 16px; border-bottom: 1px solid #2e4259; }
#nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-item { display: block; width: 100%; text-align: left; padding: 9px 18px; background: none; border: none; color: #dfe6ef; cursor: pointer; font-size: 14px; }
.nav-item:hover { background: #26395a; }
.nav-item.active { background: #324a5f; color: #fff; font-weight: 600; }
.sidebar-footer { padding: 12px 18px; border-top: 1px solid #2e4259; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; padding: 14px 24px; border-bottom: 1px solid #e1e6ee; display: flex; justify-content: space-between; align-items: center; }
.topbar h2 { font-size: 18px; }
.content { padding: 20px 24px; overflow-y: auto; }
.sos-indicator { background: #c0392b; color: #fff; padding: 6px 12px; border-radius: 20px; font-weight: 700; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }

/* Cards & stats */
.card { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; color: #1b2a41; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat .label { color: #6b7280; font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #eef1f5; font-size: 13px; }
th { background: #f7f9fb; font-weight: 600; color: #4b5563; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #e5e9f0; }
.badge-green { background: #d1f0dc; color: #17692f; }
.badge-yellow { background: #fdf0c4; color: #7a5a00; }
.badge-red { background: #f8d7d3; color: #9b2316; }
.badge-blue { background: #d6e6fb; color: #1d4f91; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 10px; padding: 22px; width: min(640px, 94vw); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* Misc */
.row-actions { display: flex; gap: 6px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #1b2a41; color: #fff; padding: 12px 18px; border-radius: 6px; z-index: 100; }
.progress { background: #e5e9f0; border-radius: 6px; height: 8px; overflow: hidden; }
.progress > div { background: #2e7d4f; height: 100%; }
.empty { color: #6b7280; padding: 20px; text-align: center; }
.guard-status-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.checkpoint { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #eef1f5; }
.timeline-item { padding: 8px 0; border-left: 3px solid #1b2a41; padding-left: 12px; margin-bottom: 8px; }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; }
  #nav { display: flex; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
}
