/* ============================================================
   TLISOFA ORG DESIGN - Stylesheet
   Tone màu chủ: xanh navy + cam nhạt (khác System Core màu tím)
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'Segoe UI', Roboto, sans-serif; background: #f1f5f9; color: #0f172a; font-size: 14px; }
a { color: #0369a1; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========= LOGIN ========= */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0c4a6e 0%, #1e40af 100%); padding: 20px; }
.login-box { background: #fff; border-radius: 12px; padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 40px rgba(0,0,0,.25); }
.login-box h1 { font-size: 28px; color: #0c4a6e; text-align: center; letter-spacing: 2px; }
.login-box .subtitle { text-align: center; color: #64748b; margin: 6px 0 24px; font-size: 13px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 6px; color: #334155; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; outline: none; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #0369a1; }
button, .btn { padding: 10px 18px; background: #0369a1; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; }
button:hover, .btn:hover { background: #0c4a6e; }
button:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #dc2626; } .btn-danger:hover { background: #991b1b; }
.btn-warn { background: #ea580c; } .btn-warn:hover { background: #9a3412; }
.btn-success { background: #059669; } .btn-success:hover { background: #047857; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.error-msg { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 8px; margin-top: 10px; font-size: 13px; }
.success-msg { background: #dcfce7; color: #166534; padding: 10px; border-radius: 8px; font-size: 13px; }
.footer-text { text-align: center; color: #64748b; font-size: 11px; margin-top: 20px; }

/* ========= NAVBAR ========= */
.navbar { background: #0c4a6e; color: #fff; padding: 10px 20px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.nav-brand { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.nav-brand-sub { font-size: 11px; opacity: .8; font-weight: 400; display: block; }
.nav-menu { display: flex; gap: 4px; flex: 1; margin-left: 16px; flex-wrap: wrap; }
.nav-menu a { color: #cbd5e1; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.nav-menu a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-menu a.active { background: #0ea5e9; color: #fff; }
.nav-user { font-size: 13px; display: flex; align-items: center; gap: 10px; }
.nav-user-name { opacity: .95; }
.nav-logout { background: #dc2626; padding: 6px 14px; }

/* ========= LAYOUT ========= */
.container { max-width: 1400px; margin: 0 auto; padding: 24px 20px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 24px; color: #0c4a6e; font-weight: 700; }
.page-subtitle { color: #64748b; font-size: 13px; margin-top: 4px; }

/* ========= CARD ========= */
.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 700; color: #0c4a6e; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid #e0f2fe; }
.card-section { padding: 14px 0; border-bottom: 1px dashed #e2e8f0; }
.card-section:last-child { border-bottom: none; }

/* ========= STATS ========= */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px; border-left: 4px solid #0369a1; }
.stat-card.orange { border-left-color: #ea580c; }
.stat-card.green { border-left-color: #059669; }
.stat-card.purple { border-left-color: #7c3aed; }
.stat-card.red { border-left-color: #dc2626; }
.stat-label { color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 28px; font-weight: 700; color: #0c4a6e; margin-top: 4px; }
.stat-change { font-size: 11px; color: #059669; margin-top: 4px; }

/* ========= TABLE ========= */
.table-wrap { background: #fff; border-radius: 10px; overflow: auto; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 13px; vertical-align: top; }
th { background: #f1f5f9; color: #334155; font-weight: 600; position: sticky; top: 0; }
tbody tr:hover { background: #f8fafc; }

/* ========= BADGES ========= */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-review { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-archived { background: #e0e7ff; color: #3730a3; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-planned { background: #fef3c7; color: #92400e; }
.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-support { background: #e5e7eb; color: #374151; }

/* RACI cell colors */
.raci-A { background: #fee2e2; color: #991b1b; font-weight: 700; text-align: center; }
.raci-R { background: #fef3c7; color: #92400e; font-weight: 700; text-align: center; }
.raci-C { background: #dbeafe; color: #1e40af; text-align: center; }
.raci-I { background: #f1f5f9; color: #64748b; text-align: center; }
.raci-AR { background: #fca5a5; color: #7f1d1d; font-weight: 700; text-align: center; }

/* ========= ORG CHART ========= */
.org-tree { padding: 20px; background: #fff; border-radius: 10px; overflow: auto; }
.org-node { display: inline-block; background: #0c4a6e; color: #fff; padding: 10px 16px; border-radius: 8px; margin: 6px;
  font-size: 13px; min-width: 180px; text-align: center; cursor: pointer; transition: all .2s; }
.org-node:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,.15); }
.org-node.level-1 { background: #0f172a; }
.org-node.level-2 { background: #1e40af; }
.org-node.level-3 { background: #0ea5e9; }
.org-node.planned { opacity: .7; border: 2px dashed #fcd34d; }
.org-node-code { font-size: 11px; opacity: .8; margin-top: 2px; }

/* ========= WIZARD STEP NAVIGATOR ========= */
.wizard-steps { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.wizard-step { padding: 8px 14px; background: #e2e8f0; color: #64748b; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; }
.wizard-step.active { background: #0369a1; color: #fff; }
.wizard-step.done { background: #059669; color: #fff; }
.wizard-body { background: #fff; padding: 24px; border-radius: 10px; }

/* ========= FORM HELPERS ========= */
textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-hint { font-size: 11px; color: #64748b; margin-top: 4px; }

.json-view { background: #f8fafc; padding: 10px; border-radius: 6px; font-family: Consolas, monospace; font-size: 12px; white-space: pre-wrap; overflow-x: auto; max-height: 400px; overflow-y: auto; }

/* ========= DFD DETAIL - 10 PHẦN ========= */
.dfd-section { margin-bottom: 22px; }
.dfd-section h3 { color: #0c4a6e; font-size: 16px; padding-bottom: 6px; border-bottom: 2px solid #0ea5e9; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.dfd-section .section-no { background: #0369a1; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.purpose-box { background: linear-gradient(90deg, #0c4a6e, #0369a1); color: #fff; padding: 20px; border-radius: 10px; font-size: 15px; line-height: 1.6; font-style: italic; }

/* ========= MODAL ========= */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 10px; max-width: 700px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; }
.modal-body { padding: 20px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #94a3b8; padding: 0; }

/* ========= APP LAUNCHER ========= */
.app-launcher-btn { background: none; border: none; color: white; cursor: pointer;
  padding: 6px; border-radius: 6px; display: flex; align-items: center; margin-right: 8px; transition: background .2s; }
.app-launcher-btn:hover { background: rgba(255,255,255,0.15); }
.app-launcher-popup { display: none; position: fixed; top: 52px; left: 8px; z-index: 9999;
  background: white; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25); width: 420px; max-height: 85vh; overflow: hidden; }
.app-launcher-popup.show { display: flex; flex-direction: column; }
.alp-header { padding: 16px 20px 12px; border-bottom: 1px solid #f0f0f0; flex-shrink: 0; }
.alp-header h3 { font-size: 15px; color: #1a202c; margin: 0 0 10px; font-weight: 700; }
.alp-search { width: 100%; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; outline: none; }
.alp-search:focus { border-color: #0369a1; }
.alp-body { overflow-y: auto; padding: 8px 0 12px; flex: 1; }
.alp-group { padding: 0 16px; }
.alp-group-title { font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; padding: 10px 4px 6px; margin-top: 4px; }
.alp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.alp-item { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 10px; cursor: pointer; transition: background .15s; text-align: center; }
.alp-item:hover { background: #f1f5f9; }
.alp-disabled { opacity: .35; cursor: default; }
.alp-disabled:hover { background: transparent; }
.alp-current { background: #e0f2fe; }
.alp-current:hover { background: #e0f2fe; cursor: default; }
.alp-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; margin-bottom: 5px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.alp-name { font-size: 11px; font-weight: 600; color: #334155; line-height: 1.2; }

/* ========= RESPONSIVE ========= */
@media (max-width: 768px) {
  .navbar { flex-direction: column; align-items: flex-start; }
  .nav-menu { width: 100%; overflow-x: auto; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
