* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f2f5; color: #1a1a2e; font-size: 13px; }

/* ── UTILITIES ── */
.hidden { display: none !important; }

/* ── LOGIN SCREEN ── */
#loginScreen {
  position: fixed; inset: 0; z-index: 9999;
  background: #1e5aa0;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: white; border-radius: 14px;
  padding: 40px 44px 36px; width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,.28);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand .logo-box {
  background: #f5a623; width: 42px; height: 42px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.login-brand-text .name { font-size: 22px; font-weight: 700; color: #1e5aa0; }
.login-brand-text .sub  { font-size: 11px; color: #888; margin-top: 1px; }
.login-card h2 { font-size: 15px; font-weight: 600; color: #222; margin-bottom: 20px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; }
.login-field .input-wrap { position: relative; }
.login-field input {
  width: 100%; padding: 9px 38px 9px 12px;
  border: 1.5px solid #cdd5e0; border-radius: 7px;
  font-size: 13px; outline: none; transition: border .15s; background: #fafbfc;
}
.login-field input:focus { border-color: #1e5aa0; background: white; }
.toggle-pw {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 15px; color: #aaa;
}
.login-error {
  background: #fdecea; border: 1px solid #f5c6c2; color: #c0392b;
  border-radius: 6px; padding: 8px 12px; font-size: 12px; margin-bottom: 14px;
}
.btn-login {
  width: 100%; padding: 10px; background: #1e5aa0; color: white;
  border: none; border-radius: 7px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background .15s; margin-top: 4px;
}
.btn-login:hover { background: #174d8f; }
.btn-login:disabled { background: #7a9fca; cursor: not-allowed; }
.login-footer { margin-top: 16px; font-size: 11px; color: #aaa; text-align: center; }
.login-footer a { color: #1e5aa0; text-decoration: none; }

/* ── TOPBAR ── */
.topbar {
  background: #1e5aa0; color: white;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.topbar-logo { display: flex; align-items: center; gap: 10px; }
.topbar-logo .logo-box {
  background: #f5a623; width: 34px; height: 34px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.topbar-logo span { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.topbar-logo small { font-size: 11px; opacity: .75; display: block; margin-top: -3px; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  color: rgba(255,255,255,.8); text-decoration: none;
  padding: 6px 14px; border-radius: 5px; font-size: 13px; transition: background .15s;
}
.topbar-nav a:hover, .topbar-nav a.active { background: rgba(255,255,255,.18); color: white; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.btn-settings {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  color: white; padding: 5px 13px; border-radius: 5px; cursor: pointer; font-size: 12px;
  transition: background .15s;
}
.btn-settings:hover { background: rgba(255,255,255,.25); }
.btn-logout { background: rgba(255,80,80,.25); border-color: rgba(255,100,100,.4); }

/* ── PAGE ── */
.page { max-width: 1400px; margin: 0 auto; padding: 24px 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: #1e5aa0; }
.page-header p { font-size: 12px; color: #666; margin-top: 2px; }

/* ── IMPORT PANEL ── */
.import-panel {
  background: white; border-radius: 10px; border: 1px solid #dde3ed;
  margin-bottom: 18px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.import-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; cursor: pointer; user-select: none;
  border-bottom: 1px solid #edf0f5;
}
.import-panel-header span { font-weight: 600; color: #1e5aa0; font-size: 13px; }
.import-panel-header .badge { background: #e8f0fb; color: #1e5aa0; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.import-body { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.import-body textarea {
  flex: 1; height: 90px; border: 1.5px solid #cdd5e0; border-radius: 7px;
  padding: 10px; font-family: 'Consolas', monospace; font-size: 12px; resize: vertical;
  background: #fafbfc; color: #333; outline: none;
}
.import-body textarea:focus { border-color: #1e5aa0; }
.import-right { display: flex; flex-direction: column; gap: 8px; min-width: 160px; }
.import-right p { font-size: 11px; color: #777; line-height: 1.5; }
.import-right code { background: #f0f2f5; padding: 2px 5px; border-radius: 3px; font-size: 11px; }

/* ── BUTTONS ── */
.btn { border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; padding: 8px 16px; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: #1e5aa0; color: white; }
.btn-success  { background: #1ab26b; color: white; }
.btn-danger   { background: #e03c3c; color: white; }
.btn-outline  { background: white; color: #1e5aa0; border: 1.5px solid #1e5aa0; }
.btn-sm       { font-size: 11px; padding: 5px 11px; border-radius: 5px; }
.btn-icon     { padding: 5px 9px; border-radius: 5px; border: none; cursor: pointer; font-size: 13px; }

/* ── TOOLBAR ── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; background: white; border: 1.5px solid #cdd5e0;
  border-radius: 7px; padding: 0 10px; gap: 6px; flex: 1; min-width: 200px; max-width: 340px;
}
.search-box input { border: none; outline: none; font-size: 13px; padding: 7px 0; background: transparent; width: 100%; }
.search-box .icon { color: #aaa; font-size: 14px; }
.filter-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tag { background: #e8f0fb; color: #1e5aa0; border-radius: 20px; padding: 3px 12px 3px 10px; font-size: 11px; display: flex; align-items: center; gap: 4px; }
.filter-tag button { background: none; border: none; cursor: pointer; color: #1e5aa0; font-size: 13px; line-height: 1; padding: 0; }

/* ── TABLE ── */
.table-wrapper { background: white; border-radius: 10px; border: 1px solid #dde3ed; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table thead th {
  background: #f5f7fb; font-weight: 700; font-size: 11px; text-align: left;
  padding: 8px 10px 4px; border-bottom: 2px solid #dde3ed; white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.data-table thead th input.col-filter {
  display: block; width: 100%; margin-top: 4px; padding: 3px 6px;
  border: 1px solid #cdd5e0; border-radius: 4px; font-size: 10px; font-weight: 400; outline: none;
}
.data-table tbody td { padding: 8px 10px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
.data-table tbody tr:hover { background: #f5f8ff; }
.data-table tbody tr:last-child td { border-bottom: none; }
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.status-open       { background: #d4edda; color: #155724; }
.status-cancelled  { background: #f8d7da; color: #721c24; }
.status-inprogress { background: #fff3cd; color: #856404; }
.status-default    { background: #e8f0fb; color: #1e5aa0; }
.sent-badge { display: inline-block; background: #d4edda; color: #155724; border-radius: 10px; padding: 2px 8px; font-size: 10px; white-space: nowrap; }
.not-sent   { color: #aaa; font-size: 11px; }
.email-input { border: 1px solid #cdd5e0; border-radius: 5px; padding: 3px 7px; font-size: 11px; width: 170px; outline: none; background: #fafbfc; }
.email-input:focus { border-color: #1e5aa0; }
.action-btns { display: flex; gap: 4px; }

/* ── TABLE FOOTER ── */
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid #edf0f5; font-size: 12px; color: #666; }
.pagination { display: flex; gap: 4px; }
.pagination button { border: 1px solid #dde3ed; background: white; border-radius: 4px; padding: 3px 9px; cursor: pointer; font-size: 12px; }
.pagination button.active { background: #1e5aa0; color: white; border-color: #1e5aa0; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.modal { background: white; border-radius: 12px; min-width: 440px; max-width: 580px; width: 100%; box-shadow: 0 8px 40px rgba(0,0,0,.22); }
.modal-wide { max-width: 860px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #edf0f5; }
.modal-header h2 { font-size: 16px; font-weight: 700; color: #1e5aa0; }
.modal-header .close { background: none; border: none; font-size: 22px; cursor: pointer; color: #aaa; line-height: 1; }
.modal-header .close:hover { color: #333; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #edf0f5; display: flex; justify-content: flex-end; gap: 8px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11px; font-weight: 600; color: #555; margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 8px 10px; border: 1.5px solid #cdd5e0; border-radius: 7px; font-size: 13px; outline: none;
}
.form-group input:focus, .form-group textarea:focus { border-color: #1e5aa0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9000;
  background: #222; color: white; padding: 12px 20px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 4px 20px rgba(0,0,0,.3);
  transform: translateY(20px); opacity: 0; transition: all .25s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #c0392b; }
