:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 1375px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.logo__img {
    height: 32px;
    width: auto;
    display: block;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav > a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.nav > a:hover {
    color: var(--primary);
}

.dropdown {
    position: relative;
}

.dropdown__toggle {
    background: transparent;
    border: none;
    color: var(--muted);
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.25rem 0;
}

.dropdown__toggle:hover {
    color: var(--primary);
}

.dropdown__menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 0.35rem 0;
    display: none;
    z-index: 20;
}

.dropdown--right {
    position: relative;
}

.dropdown__menu--right {
    left: auto;
    right: 0;
}

.dropdown:hover .dropdown__menu,
.dropdown:focus-within .dropdown__menu {
    display: block;
}

.dropdown__menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    white-space: nowrap;
}

.dropdown__menu a:hover {
    background: var(--bg);
    color: var(--primary);
}

.auth {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.auth__role {
    background: var(--primary);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
}

.auth__role--super_admin {
    background: #dc2626;
}

.auth__role--sysadmin {
    background: #2563eb;
}

.auth__role--hr {
    background: #16a34a;
}

.auth__role--department_head {
    background: #92400e;
}

.auth__name {
    color: var(--text);
    font-weight: 700;
    text-transform: capitalize;
}

.badge {
    display: inline-block;
    background: #eef2ff;
    color: #3730a3;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.inline-form {
    display: inline;
    margin: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    padding: 0.25rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.icon-btn:hover {
    color: var(--primary);
    background: var(--bg);
}

.icon-btn--danger:hover {
    color: var(--danger);
}

.main {
    padding: 2rem 1rem 3rem;
}

h1 {
    margin: 0 0 1.5rem;
    font-size: 1.75rem;
}

.hero__subtitle {
    color: var(--muted);
    margin-top: -1rem;
    margin-bottom: 2rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.card h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.form {
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.form__group {
    margin-bottom: 1rem;
}

.form__group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.form__group input,
.form__group select,
.form__group textarea,
.search-form input[type="search"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}

.form__group select,
.per-page-form select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1.5 3.5l1-1L6 6l3.5-3.5 1 1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 12px;
    padding-right: 2.25rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--primary-hover);
}

.btn--danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn--danger:hover {
    background: var(--danger-hover);
}

.btn--ghost {
    background: transparent;
}

.btn--small {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

.messages {
    margin-bottom: 1rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.alert--success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert--error {
    background: var(--error-bg);
    color: var(--error-text);
}

.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-form input[type="search"] {
    flex: 1;
    min-width: 240px;
}

.toolbar {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.per-page-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.per-page-form select {
    padding: 0.4rem 2rem 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: #f9fafb;
    font-size: 0.9rem;
}

.table tr:last-child td {
    border-bottom: none;
}

.muted {
    color: var(--muted);
}

.empty {
    color: var(--muted);
    padding: 2rem;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pagination__info {
    color: var(--muted);
    font-size: 0.95rem;
}

.pagination__controls {
    display: flex;
    gap: 0.5rem;
}

.confirm-block {
    margin-top: 2rem;
    max-width: 520px;
}

.details {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.details dt {
    color: var(--muted);
}

.details dd {
    margin: 0;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.equipment-list {
    margin: 0;
    padding-left: 1.1rem;
}

.equipment-list li {
    margin-bottom: 0.25rem;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal.is-open {
    display: flex;
}

.modal__dialog {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    max-width: 520px;
    width: 100%;
}

.modal__title {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}

.modal__message {
    margin: 0 0 0.5rem;
}

.modal__warning {
    color: var(--error-text);
    font-weight: 500;
    margin: 0.75rem 0 0.5rem;
}

.modal__extra .equipment-list {
    margin: 0;
    padding-left: 1.1rem;
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .table {
        display: block;
        overflow-x: auto;
    }
}
