/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1a56db;
  --primary-d: #1140a6;
  --success: #057a55;
  --danger: #c81e1e;
  --warn: #b45309;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-light: #6b7280;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

/* ── Navbar ── */
.navbar {
  background: #1e293b;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.nav-icon {
  font-size: 20px;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  color: #cbd5e1;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  transition: background .15s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-name {
  color: #e2e8f0;
  font-size: 13px;
}

.btn-logout {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12px;
  transition: background .15s;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, .25);
}

.container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 24px;
  box-sizing: border-box;
}

/* Tắt padding của container chính đối với các trang đã tự định nghĩa padding trong container con */
.container:has(.analyze-container),
.container:has(.logs-page-container),
.container:has(.user-company-container),
.container:has(.admin-dashboard),
.container:has(.company-page) {
  padding: 0;
}

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

/* ── Page Header ── */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
}

.page-header p {
  color: var(--text-light);
  margin-top: 4px;
}

/* ── Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 32px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ── Section ── */
.section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1e293b;
}

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  color: #374151;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #f9fafb;
}

.row-inactive td {
  opacity: .55;
}

.file-icon {
  margin-right: 6px;
}

.action-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, opacity .15s;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-d);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #046c4e;
}

.btn-warn {
  background: var(--warn);
  color: #fff;
}

.btn-warn:hover {
  background: #92400e;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #9b1c1c;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ── Role Badges ── */
.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.role-admin {
  background: #ede9fe;
  color: #5b21b6;
}

.role-director {
  background: #dbeafe;
  color: #1e40af;
}

.role-secretary {
  background: #d1fae5;
  color: #065f46;
}

/* ── Status ── */
.status-badge {
  font-size: 12px;
  font-weight: 500;
}

.status-active {
  color: var(--success);
}

.status-inactive {
  color: var(--text-light);
}

/* ── Permission badges ── */
.permission-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.permission-info h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1e40af;
}

.permission-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.perm-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.perm-allowed {
  color: #065f46;
}

.perm-denied {
  color: #991b1b;
}

/* ── Sign Card ── */
.sign-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

/* ── Forms ── */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: #374151;
}

.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=email],
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border .15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .1);
}

.form-hint {
  color: var(--text-light);
  font-size: 12px;
  margin-top: 4px;
}

.inline-form .form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.inline-form .form-group {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}

.form-group-btn {
  flex: 0 0 auto !important;
}

/* ── File Drop Zone ── */
.file-drop-zone {
  border: 2px dashed #93c5fd;
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  background: #eff6ff;
  transition: border .2s, background .2s;
  position: relative;
}

.file-drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--primary);
  background: #dbeafe;
}

.drop-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

.drop-hint p,
.file-selected p {
  color: #374151;
  font-size: 14px;
}

.drop-sub {
  color: var(--text-light) !important;
  font-size: 12px !important;
  margin-top: 4px;
}

/* ── Flow Info ── */
.flow-info {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 20px 0;
}

.flow-info h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 10px;
}

.flow-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.flow-step {
  background: #fff;
  border: 1px solid #86efac;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: #166534;
}

.flow-arrow {
  color: #16a34a;
  font-weight: 700;
}

/* ── Logs ── */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-header {
  display: grid;
  grid-template-columns: 200px 160px 1fr;
  gap: 20px;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: #e2e8f0;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  color: #1e293b;
}

.log-entry {
  display: grid;
  grid-template-columns: 200px 160px 1fr;
  gap: 20px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 8px;
  background: #f8fafc;
  border-left: 4px solid #e5e7eb;
}

.log-entry.log-auth {
  border-left-color: #6366f1;
}

.log-entry.log-sign {
  border-left-color: #10b981;
}

.log-entry.log-acl {
  border-left-color: #f59e0b;
}

.log-time {
  font-size: 15px;
  color: #64748b;
  white-space: nowrap;
}

.log-event {
  display: inline-block;
  width: fit-content;
  font-size: 14px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  background: #dbeafe;
  color: #1e40af;
}

.log-detail {
  font-size: 16px;
  line-height: 1.6;
  word-break: break-word;
}

.empty-state {
  padding: 30px;
  text-align: center;
  font-size: 16px;
}

/* ── Login Page ── */
.login-page {
  background: linear-gradient(135deg, #1e293b 0%, #1e40af 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
}

.login-logo p {
  color: var(--text-light);
  font-size: 13px;
  margin-top: 4px;
}

.login-form .btn-full {
  margin-top: 4px;
}

.login-hint {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.login-hint p {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.hint-table {
  width: 100%;
  font-size: 12px;
}

.hint-table td {
  padding: 3px 8px;
}

.hint-table td:first-child {
  width: 40%;
}

/* ── Error Page ── */
.error-page {
  text-align: center;
  padding: 80px 20px;
}

.error-code {
  font-size: 80px;
  font-weight: 900;
  color: #e5e7eb;
}

.error-message {
  font-size: 18px;
  color: var(--text);
  margin: 10px 0 24px;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* ── Logo ── */
.logo-img {
  width: 270px;
  height: auto;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}

.nav-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* ── Log table ── */
.log-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.log-table th {
  background: #f1f5f9;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 10px;
  text-align: left;
}

.log-table td {
  padding: 14px 10px;
  vertical-align: top;
  font-size: 15px;
  border-bottom: 1px solid #e5e7eb;
}

.log-time-cell {
  width: 170px;
  white-space: nowrap;
  color: #64748b;
}

.log-detail-cell {
  word-break: break-word;
  line-height: 1.6;
}

.log-event {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  background: #dbeafe;
  color: #1d4ed8;
}

.log-event-cell {
  width: 130px;
}

/* ── Register ── */
.register-page {
  margin: 0;
  background: #edf3fb;
  font-family: Segoe UI, Arial, sans-serif;
}

.register-container {
  display: flex;
  min-height: 100vh;
}

.register-sidebar {
  width: 280px;
  background: #0c2f6b;
  color: white;
  padding: 35px;
  box-sizing: border-box;
}

.sidebar-logo {
  width: 170px;
  margin-bottom: 20px;
}

.register-sidebar h2 {
  margin-top: 25px;
  font-size: 30px;
}

.sidebar-subtitle {
  color: #dbe7ff;
  margin-bottom: 35px;
}

.sidebar-item {
  margin-bottom: 35px;
}

.sidebar-item h4 {
  margin-bottom: 10px;
}

.sidebar-item p {
  color: #dbe7ff;
  font-size: 14px;
  line-height: 22px;
}

.register-content {
  flex: 1;
  padding: 40px;
}

.register-box {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .08);
}

.stepper {
  display: flex;
  align-items: center;
  margin-top: 35px;
  margin-bottom: 40px;
}

.step {
  display: flex;
  align-items: center;
  color: #999;
  font-weight: 600;
}

.step.active {
  color: #0b63f6;
}

.step span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ddd;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 10px;
  color: white;
}

.step.active span {
  background: #0b63f6;
}

.line {
  flex: 1;
  height: 2px;
  background: #ddd;
  margin: 0 20px;
}

/* ── Register Form step 1 ── */
.form-title {
  margin-bottom: 30px;
}

.form-title h2 {
  margin-bottom: 8px;
  color: #16345f;
}

.form-title p {
  color: #777;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.form-group input {
  height: 46px;
  padding: 0 15px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
}

.form-group input:focus {
  border-color: #1677ff;
}

.full {
  grid-column: 1/3;
}

.notice {
  margin-top: 30px;
  padding: 15px 18px;
  background: #edf5ff;
  border: 1px solid #c8defd;
  color: #2d5ba8;
  border-radius: 8px;
  font-size: 14px;
}

.button-group {
  display: flex;
  justify-content: space-between;
  margin-top: 35px;
}

.btn-secondary {
  background: white;
  border: 1px solid #ccc;
  padding: 12px 30px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary {
  background: #1677ff;
  color: white;
  border: none;
  padding: 12px 35px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary:hover {
  background: #0958d9;
}

/* ── Register Form step 3 ── */
.confirm-grid {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.confirm-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  background: #fff;
}

.confirm-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #16345f;
}

.review-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #eee;
  font-size: 14px;
}

.review-item:last-child {
  border-bottom: none;
}

.review-item span {
  color: #666;
}

.review-item strong {
  color: #111;
}

.btn-primary:disabled {
  background: #cfcfcf;
  color: #ffffff;
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-secondary:disabled {
  background: #e5e5e5;
  cursor: not-allowed;
}

.register-footer {
  margin-top: 30px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.register-footer a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.register-footer a:hover {
  text-decoration: underline;
}

.role-section {
  max-width: 380px;
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid #f1f5f9;
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-content: center;
  margin-bottom: 20px;
}

.role-header__title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.role-header__btn-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.role-header__btn-add:hover {
  background: #7c3aed;
  color: #ffffff;
  border-color: #7c3aed;
}

.role-item__info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.role-item__icon-box {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #f1f5f9;
  color: #475569;
  flex-shrink: 0;
}

.role-item__name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.role-item__number {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.role-item--active {
  background: #f3f0ff !important;
}

.role-item--active .role-item__icon-box {
  background: #ffffff;
  color: #7c3aed;
}

.role-item--active .role-item__name {
  color: #7c3aed;
  font-weight: 700;
}

.role-item--active .role-item__number {
  color: #7c3aed;
  font-weight: 600;
}

.role-item--director .role-item__icon-box {
  background: #f3f0ff;
  color: #7c3aed;
}

.role-item--chief_accountant .role-item__icon-box {
  background: #fff7ed;
  color: #ea580c;
}

.role-item--secretary .role-item__icon-box {
  background: #f3f0ff;
  color: #7c3aed;
}

.role-item--business_manager .role-item__icon-box {
  background: #f0fdf4;
  color: #16a34a;
}

.role-item--hr_manager .role-item__icon-box {
  background: #eff6ff;
  color: #2563eb;
}

.role-item--tax_manager .role-item__icon-box {
  background: #fff7ed;
  color: #d97706;
}

.role-item--manager .role-item__icon-box {
  background: #f5f3ff;
  color: #6366f1;
}

.role-item--admin .role-item__icon-box {
  background: #fdf2f8;
  color: #db2777;
}

/* Custom Password Visibility Toggle Styles */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrapper input {
  padding-right: 40px !important;
}

.toggle-password-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  outline: none;
  z-index: 10;
}

.toggle-password-btn:hover {
  color: #334155;
}

input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none !important;
}