:root{
  --bg:#f5f7fb;
  --white:#ffffff;
  --ink:#0A2342;
  --muted:#6b7280;
  --brand:#0A2342;
  --brand-2:#274b7a;
  --accent:#1f6feb;
  --green:#4caf50;
  --red:#d9534f;
  --amber:#f59e0b;
  --rounded:16px;
  --shadow:0 10px 24px rgba(2,22,60,.08);
  --card-shadow:0 10px 18px rgba(2,22,60,.07);
  --radius:14px;
  --gap:18px;
  font-size:16px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: "Nunito", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:var(--bg);
  color:#0f172a;
}

.layout{
  display:grid;
  grid-template-columns: 280px 1fr;
  min-height:100vh;
  transition: grid-template-columns 0.3s ease-in-out;
}
.layout.sidebar-closed {
  grid-template-columns: 0px 1fr;
}

.sidebar{
  background:#e7eef4;
  padding:28px 22px;
  position:sticky; top:0; height:100vh;
  border-right:1px solid #dbe3ee;
  

  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.3s ease-in-out, padding 0.3s ease-in-out;
}
.layout.sidebar-closed .sidebar {
  margin-left: -280px;
  padding-left: 0;
  padding-right: 0;
  border-right-color: transparent;
}

.brand{display:flex; flex-direction:column; align-items:center; gap:10px; margin-bottom:24px}
.brand img{width:120px; height:auto; object-fit:contain}
.brand h3{margin:0; font-weight:800; letter-spacing:.3px; color:var(--ink)}
.brand p{margin:0; margin-top:-4px; color:var(--muted); font-size:.96rem}

.menu{
  display:flex; flex-direction:column; gap:8px; margin-top:10px;
  flex-grow: 1; 
}
.menu a{
  display:flex; align-items:center; gap:10px;
  background:transparent; color:#0f172a; text-decoration:none;
  padding:12px 14px; border-radius:14px; font-weight:700; font-size:1rem;
  transition:.2s ease;
}
.menu a:hover{background:#dde7f2}
.menu a.active{background:var(--white); box-shadow:var(--card-shadow); border:1px solid #eaf0f7}

.menu-logout {
  margin-top: 20px; 
  padding-top: 15px;
  border-top: 2px solid #dbe3ee;
}
.menu-logout a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  transition: .2s ease;
  background: #f8fafc;
  color: #b91c1c; 
}
.menu-logout a:hover {
  background: #dc2626; 
  color: #ffffff;
}

.main-wrapper {
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  overflow-x: hidden;
}
.main{
  padding:26px 30px;
  flex-grow: 1;
  overflow-y: auto;
}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:18px;
  padding: 26px 30px 0 30px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.main {
  padding: 0 30px 26px 30px;
}

.topbar h2{margin:0; font-size:2rem; letter-spacing:.3px; color:var(--ink)}
.user{display:flex; align-items:center; gap:12px; color:var(--muted); font-weight:700}
.logout{
  background:var(--brand); color:#fff; text-decoration:none; padding:10px 16px;
  border-radius:12px; box-shadow:var(--shadow); font-weight:800
}
.logout:hover{background:var(--brand-2)}

/* Hamburger Menu */
.hamburger-menu {
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 0 10px;
  margin-left: -10px; 
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 15px;
}
.topbar h2 {
  margin: 0; 
}

.login-wrap{max-width:980px; margin:40px auto; display:grid; grid-template-columns: 1fr 1fr; background:#fff; border-radius:18px; overflow:hidden; box-shadow:var(--shadow)}
.login-left{background:#2c7be4; color:#fff; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:30px 24px; gap:10px}
.login-left img{width:120px}
.login-left h2{margin:0; font-size:22px; text-align:center}
.login-right{padding:34px}
.login-right h3{margin-top:0; font-size:22px}
.login-right .alert{margin-top:6px}
.login-right button{margin-top:8px}


.cards{display:grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap:20px; margin:18px 0 26px}
.card{
  background:var(--white); border-radius:var(--radius); padding:22px;
  box-shadow:var(--card-shadow); border:1px solid #eef2f7
}
.card .icon{font-size:30px}
.card h3{margin:8px 0 8px; color:var(--ink); font-size:1.4rem}
.card p{margin:0 0 12px; color:var(--muted)}
.btn{
  background:var(--brand); color:#fff; border:none; text-decoration:none;
  padding:10px 16px; border-radius:12px; font-weight:800; display:inline-block
}
.btn:hover{background:var(--brand-2)}

.matrix-container {
  margin-top: 10px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);

  /* ✅ keep table inside on small screens */
  width: 100%;
  max-width: 100%;
  overflow-x: auto;               /* enable horizontal scroll if needed */
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  margin-bottom: 15px;

  /* ✅ prevent columns from expanding container */
  table-layout: fixed;
}

.matrix-table th, .matrix-table td {
  border: 1px solid #e5e7eb;
  padding: 8px;

  /* ✅ allow wrapping instead of pushing width */
  word-break: break-word;
  white-space: normal;
}

.axis-x { background: #fee2e2; color: #7f1d1d; }
.axis-y { background: #fee2e2; color: #7f1d1d; writing-mode: vertical-lr; transform: rotate(180deg); text-align: center; }


.legend { font-size: 14px; }
.legend-item { display: inline-flex; align-items: center; margin-right: 10px; }
.legend-item span { display: inline-block; width: 16px; height: 16px; margin-right: 6px; border-radius: 4px; border: 1px solid #ccc; }



/* .matrix-container {
  margin-top: 10px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  margin-bottom: 15px;
}
.matrix-table th, .matrix-table td {
  border: 1px solid #e5e7eb;
  padding: 8px;
}
.axis-x { background: #fee2e2; color: #7f1d1d; }
.axis-y { background: #fee2e2; color: #7f1d1d; writing-mode: vertical-lr; transform: rotate(180deg); text-align: center; }
.legend { font-size: 14px; }
.legend-item { display: inline-flex; align-items: center; margin-right: 10px; }
.legend-item span { display: inline-block; width: 16px; height: 16px; margin-right: 6px; border-radius: 4px; border: 1px solid #ccc; }  */ */

.form-card{background:var(--white); border-radius:var(--radius); padding:22px; box-shadow:var(--card-shadow); border:1px solid #eef2f7}
form label {font-weight:700;margin-top:10px;display:block;}
form input, form textarea, form select {
  width:100%; padding:10px; border:1px solid #dbe3ee;
  border-radius:8px; margin-top:5px; font-size:14px;
}
input:focus,textarea:focus,select:focus{border-color:#6aa7ff; box-shadow:0 0 0 3px rgba(26,115,232,.15)}
textarea{min-height:90px; resize:vertical}
.form-section {margin-top:30px; border-top:2px solid #f1f5f9; padding-top:15px;}
.row-2 {display:grid; grid-template-columns:repeat(2,1fr); gap:12px;}
.readonly-box {background:#f3f4f6; border:1px solid #cbd5e1;}
button.btn-save {
  background:#0A2342; color:#fff; border:none;
  padding:10px 16px; border-radius:8px; cursor:pointer;
  font-weight:bold; margin-top:20px;
}
.alert{background:#eaf5ff; border:1px solid #cfe6ff; padding:10px 14px; color:#0b316b; border-radius:10px; font-weight:800; margin-bottom:12px}
.error{background:#ffecec; border-color:#ffd3d3; color:#7a0f0f}
.success{background:#ecfff3; border-color:#c6f1d6; color:#0b6b2b}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 15px 0;
}
.filter-bar input, .filter-bar select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
}
.filter-bar button {
  background: #0A2342;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.filter-bar button:hover { background: #163a6b; }

.table-container {
  overflow-x: auto;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1700px;
  font-size: 14px;
}
th, td {
  border: 1px solid #e2e8f0;
  padding: 10px;
  text-align: left;
  white-space: nowrap;
}
th {
  background: #0A2342;
  color: white;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}
tr:nth-child(even) { background: #f8fafc; }
tr:hover { background: #f6f9ff; }

.action-btn {
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  color: #fff;
  display:inline-block;
  margin-right: 4px;
}
.edit { background: #16a34a; }
.delete { background: #dc2626; }
.btn-add {
  background: #0A2342;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.scroll-hint {
  color: #64748b;
  font-size: 13px;
  margin-top: 8px;
  text-align: right;
  font-style: italic;
}
.table-container::-webkit-scrollbar { height: 8px; }
.table-container::-webkit-scrollbar-thumb { background-color: #94a3b8; border-radius: 8px; }

.chart-card {
  background: #fff;
  padding: 25px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  max-width: 950px;
  margin: 15px auto; 
}
.chart-card h2 {
  color: #0A2342;
  margin-bottom: 10px;
}
.chart-card select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
}
.chart-card label {
  font-weight: bold;
}


@media (max-width: 980px){
  .layout{grid-template-columns: 1fr}
  .sidebar{position:relative; height:auto}
  .rr-grid{grid-template-columns: 1fr}
  table{min-width:900px}
  .login-wrap{grid-template-columns:1fr}
  
  .layout {
    grid-template-columns: 0px 1fr;
  }
  .layout.sidebar-closed {
    grid-template-columns: 0px 1fr;
  }
  .sidebar {
    margin-left: -280px;
  }
}