:root {
  --primary: #6C5CE7;
  --primary-dark: #5A4BD1;
  --primary-light: #EFECFD;
  --bg: #F4F5FA;
  --card: #FFFFFF;
  --border: #ECEDF3;
  --text: #2D2F45;
  --text-muted: #8B8FA3;
  --text-soft: #B4B7C9;
  --blue: #4A90E2; --blue-bg: #EAF2FD;
  --orange: #F5A623; --orange-bg: #FEF3E1;
  --green: #2ECC71; --green-bg: #E7F9EE;
  --red: #E74C3C; --red-bg: #FDECEA;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(45, 47, 69, 0.06);
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ============ LOGIN ============ */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 780px) { .login-shell { grid-template-columns: 1fr; } .login-aside { display: none; } }
.login-aside {
  background: linear-gradient(160deg, var(--primary), #4834B8);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-aside .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.login-aside .brand .mark {
  width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
}
.login-aside h1 { font-size: 32px; font-weight: 700; line-height: 1.3; max-width: 420px; margin-top: 40px; }
.login-aside p.desc { margin-top: 12px; color: #D9D3FA; max-width: 380px; }
.login-aside .footnote { font-size: 12px; color: #C6BEF3; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-card .sub { color: var(--text-muted); margin-bottom: 28px; font-size: 13px; }

/* ============ FORM ELEMENTS ============ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: var(--radius-sm); border: none; font-family: var(--font);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary.full { width: 100%; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--red-bg); color: var(--red); border: none; }
.btn-danger:hover { background: #FADBD8; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 12px; }

.error-msg {
  background: var(--red-bg); color: var(--red); border: 1px solid #F5C6C0;
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: none;
}
.error-msg.show { display: block; }

/* ============ APP SHELL ============ */
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .app-shell { grid-template-columns: 76px 1fr; } .sidebar .label-text { display: none; } .sidebar .brand span { display: none; } }

.sidebar { background: #fff; border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; margin-bottom: 32px; font-weight: 700; font-size: 17px; }
.sidebar .brand .mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.sidebar .menu-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-soft); padding: 0 12px; margin: 18px 0 8px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; color: var(--text-muted); text-decoration: none;
  padding: 11px 12px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
}
.sidebar nav a .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar nav a:hover { background: var(--primary-light); color: var(--primary); }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .bottom { margin-top: auto; border-top: 1px solid var(--border); padding-top: 16px; }
.sidebar .bottom button {
  width: 100%; display: flex; align-items: center; gap: 12px; background: none; border: none;
  color: var(--text-muted); padding: 11px 12px; border-radius: var(--radius-sm); font-size: 13.5px;
  cursor: pointer; font-family: var(--font); text-align: left;
}
.sidebar .bottom button:hover { background: var(--red-bg); color: var(--red); }

.main { padding: 28px 36px; max-width: 1280px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 21px; font-weight: 700; }
.topbar .sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; }
.topbar .avatar-circle {
  width: 38px; height: 38px; border-radius: 50%; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.topbar .user-chip .who { font-size: 13px; }
.topbar .user-chip .who small { display: block; color: var(--text-muted); font-size: 11px; }

/* ============ STAT CARDS ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; align-items: center; gap: 14px; }
.stat-card .icon-badge { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-card .icon-badge.blue { background: var(--blue-bg); color: var(--blue); }
.stat-card .icon-badge.purple { background: var(--primary-light); color: var(--primary); }
.stat-card .icon-badge.orange { background: var(--orange-bg); color: var(--orange); }
.stat-card .icon-badge.green { background: var(--green-bg); color: var(--green); }
.stat-card .icon-badge.red { background: var(--red-bg); color: var(--red); }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.stat-card .value { font-size: 22px; font-weight: 700; }

.panel-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.duty-list { display: flex; flex-direction: column; gap: 12px; }
.duty-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.duty-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.duty-item .name { font-weight: 600; }
.duty-item .role { color: var(--text-muted); font-size: 12px; }

/* ============ TABS (tampilan card) ============ */
.tabs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.tab-btn {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); cursor: pointer;
  font-family: var(--font); transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.tab-btn:hover { border-color: var(--primary); transform: translateY(-1px); }
.tab-btn .tab-icon {
  width: 38px; height: 38px; border-radius: 10px; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab-btn .tab-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tab-btn .tab-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.tab-btn .tab-desc { font-size: 11.5px; font-weight: 400; color: var(--text-muted); line-height: 1.4; }
.tab-btn.active { border-color: var(--primary); background: var(--primary-light); }
.tab-btn.active .tab-icon { background: var(--primary); color: #fff; }
.tab-btn.active .tab-title { color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============ SECTION HEAD (judul + tombol Edit Data) ============ */
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.section-head h3 { font-size: 15px; font-weight: 700; }
.section { margin-bottom: 28px; }
.section:last-child { margin-bottom: 0; }

/* ============ INFO CARDS (tampilan data read-only) ============ */
.info-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.info-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.info-card h4 { font-size: 13.5px; font-weight: 700; color: var(--primary); padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.info-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--text-muted); flex-shrink: 0; }
.info-row .v { font-weight: 600; text-align: right; word-break: break-word; }

/* ============ MANAGE MODAL (dibuka lewat tombol "Edit Data") ============ */
.manage-backdrop { z-index: 40; }
.manage-modal { max-width: 920px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h3 { margin-bottom: 0; }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 0 4px; font-family: var(--font); }
.modal-close:hover { color: var(--text); }

/* ============ TOOLBAR / TABLE ============ */
.toolbar { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type="search"] { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; min-width: 240px; font-family: var(--font); }

.card-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
  padding: 13px 18px; border-bottom: 1px solid var(--border); background: #FAFAFD;
}
td { padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFAFD; }

.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--border); display: inline-block; vertical-align: middle; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 100px; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--primary-light); color: var(--primary); }

.row-actions { display: flex; gap: 14px; }
.row-actions button { background: none; border: none; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--primary); padding: 0; font-family: var(--font); }
.row-actions button.danger { color: var(--red); }
.row-actions button:hover { text-decoration: underline; }

.empty-state { text-align: center; padding: 56px 16px; color: var(--text-muted); }
.loading-text { color: var(--text-muted); font-size: 13px; padding: 20px; text-align: center; }
a.file-link { color: var(--primary); font-weight: 600; text-decoration: none; }
a.file-link:hover { text-decoration: underline; }

/* ============ MODAL ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(45, 47, 69, 0.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-backdrop.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; padding: 28px; }
.modal h3 { font-size: 17px; margin-bottom: 20px; font-weight: 700; }
.modal .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.foto-preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--bg); border: 1px solid var(--border); margin-bottom: 12px; }
