* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Arial, sans-serif; margin: 0; background: #f5f6f8; color: #1f2430;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
main { padding: 12px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 19px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
a { color: #2c6fbb; }
.subtitle { color: #667; font-size: 13px; margin-bottom: 14px; }
.muted { color: #888; font-size: 12px; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: white;
  border-bottom: 1px solid #e2e5ea; padding: 8px 14px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: #1f2430; text-decoration: none; }
.brand .badge {
  background: #2c6fbb; color: white; border-radius: 8px; width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 14px; letter-spacing: 0.5px;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: #445; font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 8px; }
.nav a.active { background: #e8f1fb; color: #1f4f85; }
.who { margin-left: auto; font-size: 13px; color: #556; display: flex; align-items: center; gap: 10px; }

/* buttons and inputs */
button {
  background: #2c6fbb; color: white; border: none; border-radius: 8px; padding: 10px 14px;
  cursor: pointer; font-size: 14px; min-height: 40px; font-family: inherit;
}
button:hover { background: #235a99; }
button.secondary { background: #e2e5ea; color: #1f2430; }
button.secondary:hover { background: #cfd3da; }
button.danger { background: #d9534f; }
button.danger:hover { background: #c9302c; }
button.small { min-height: 32px; padding: 6px 12px; font-size: 13px; }
button:disabled { background: #ccc; color: white; cursor: not-allowed; }
label { display: block; font-size: 12px; font-weight: 600; margin: 10px 0 4px; }
input[type=text], input[type=tel], input[type=url], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], textarea, select {
  width: 100%; padding: 10px; border: 1px solid #ccd2da; border-radius: 6px; font-size: 16px; font-family: inherit; background: white;
}
textarea { resize: vertical; min-height: 60px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-height: 40px; font-size: 14px; padding: 8px 10px; }

.card { background: white; border-radius: 10px; padding: 14px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.error-box, .success-box, .msg { padding: 8px 10px; border-radius: 6px; font-size: 13px; margin-top: 10px; display: none; }
.error-box, .msg.error { background: #fdeaea; color: #9b2c2c; }
.success-box, .msg.success { background: #e3f5e5; color: #1c6b2a; }
.warn-box { background: #fff3cd; color: #8a6d00; padding: 8px 10px; border-radius: 6px; font-size: 13px; margin-top: 10px; }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
table { border-collapse: collapse; width: 100%; background: white; border-radius: 8px; overflow: hidden; }
th, td { border: 1px solid #e2e5ea; padding: 8px; font-size: 13px; text-align: left; }
th { background: #eef1f5; font-weight: 600; }
tr.total-row td { font-weight: 700; background: #eef1f5; }

/* modals */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  align-items: center; justify-content: center; z-index: 100; padding: 12px;
}
.modal-backdrop.show { display: flex; }
.modal { background: white; border-radius: 10px; padding: 20px; width: 480px; max-width: 100%; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-top: 0; font-size: 17px; }
.modal .meta { color: #667; font-size: 13px; margin-bottom: 16px; }
.modal-actions { margin-top: 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-actions button { flex: 1 1 auto; }

/* login */
.login-card { max-width: 420px; margin: 50px auto; background: white; border-radius: 10px; padding: 26px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.login-card .brand { margin-bottom: 14px; }
.link-btn { background: none; color: #2c6fbb; padding: 0; min-height: 0; font-size: 13px; text-decoration: underline; }
.link-btn:hover { background: none; color: #235a99; }
