/* =========================================================
   GLOBAL — Microsoft 365 / Business Central style
   ========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Segoe UI Web", Arial, sans-serif;
    background: #faf9f8;
    color: #242424;
    font-size: 14px;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}


/* =========================================================
   TOP BAR (M365 black app bar)
   ========================================================= */

.topbar {
    height: 48px;
    background: #1b1a19;
    border-bottom: 1px solid #000;
    display: flex;
    align-items: center;
    padding: 0 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    gap: 8px;
}

.waffle {
    display: grid;
    grid-template-columns: repeat(3, 5px);
    grid-template-rows: repeat(3, 5px);
    gap: 2px;
    width: 21px;
    height: 21px;
    padding: 6px;
    border-radius: 3px;
    cursor: pointer;
}

.waffle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.waffle span {
    width: 5px;
    height: 5px;
    background: #ffffff;
    border-radius: 1px;
}

.logo {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background: linear-gradient(135deg, #0f6cbd 0%, #50e6ff 100%);
}

.topbar-title {
    font-size: 15px;
    font-weight: 400;
    color: #d6d6d6;
    padding-left: 8px;
    border-left: 1px solid #4a4a4a;
    white-space: nowrap;
}

.topbar-search {
    flex: 1;
    display: flex;
    justify-content: center;
}

.topbar-search-box {
    position: relative;
    width: 100%;
    max-width: 480px;
}

.topbar-search-box input {
    width: 100%;
    height: 32px;
    background: #3b3a39;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #fff;
    padding: 0 12px 0 34px;
    outline: none;
    font-size: 13px;
}

.topbar-search-box input::placeholder {
    color: #c8c6c4;
}

.topbar-search-box input:focus {
    background: #201f1e;
    border-color: #0f6cbd;
}

.topbar-search-icon {
    position: absolute;
    left: 10px;
    top: 7px;
    color: #c8c6c4;
    font-size: 13px;
    pointer-events: none;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-button {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0f6cbd;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-left: 6px;
}

.user-name {
    display: none;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    position: fixed;
    top: 48px;
    left: 0;
    bottom: 0;
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e1dfdd;
    overflow-y: auto;
    z-index: 900;
}

.menu-title {
    padding: 20px 18px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #616161;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: #242424;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: 0.12s;
    font-size: 14px;
}

.menu-item:hover {
    background: #f3f2f1;
    color: #0f6cbd;
}

.menu-item.active {
    background: #edf3fc;
    color: #0f6cbd;
    border-left-color: #0f6cbd;
    font-weight: 600;
}

.menu-icon {
    width: 22px;
    text-align: center;
}


/* =========================================================
   MAIN CONTENT
   ========================================================= */

.main-content {
    margin-left: 240px;
    padding: 72px 30px 40px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #201f1e;
}

.page-description {
    margin-top: 4px;
    color: #616161;
}


/* =========================================================
   BUTTON
   ========================================================= */

.btn {
    border: 1px solid #8a8886;
    background: white;
    padding: 7px 16px;
    border-radius: 2px;
    font-size: 14px;
    color: #242424;
    cursor: pointer;
}

.btn:hover {
    background: #f3f2f1;
}

.btn-primary {
    background: #0f6cbd;
    border-color: #0f6cbd;
    color: white;
}

.btn-primary:hover {
    background: #115ea3;
    border-color: #115ea3;
}

.btn-danger {
    background: #d13438;
    border-color: #d13438;
    color: white;
}

.btn-danger:hover {
    background: #a4262c;
}

.btn-secondary {
    background: #f3f2f1;
}


/* =========================================================
   COMMAND BAR / TOOLBAR (BC ribbon-style)
   ========================================================= */

.toolbar {
    background: #ffffff;
    border: 1px solid #e1dfdd;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.search-box {
    position: relative;
    width: 320px;
}

.search-box input {
    width: 100%;
    height: 34px;
    padding: 0 12px 0 34px;
    border: 1px solid #c8c6c4;
    border-radius: 2px;
    outline: none;
}

.search-box input:focus {
    border-color: #0f6cbd;
    box-shadow: 0 0 0 1px #0f6cbd;
}

.search-icon {
    position: absolute;
    left: 11px;
    top: 8px;
    color: #616161;
}


/* =========================================================
   TABLE
   ========================================================= */

.table-container {
    background: white;
    border: 1px solid #e1dfdd;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #faf9f8;
    text-align: left;
    font-weight: 600;
    color: #424242;
    border-bottom: 1px solid #e1dfdd;
    padding: 10px 12px;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tbody tr:hover {
    background: #f5faff;
}

.data-table tbody tr.selected {
    background: #edf3fc;
}

.table-link {
    color: #0f6cbd;
    text-decoration: none;
    font-weight: 500;
}

.table-link:hover {
    text-decoration: underline;
}


/* =========================================================
   STATUS
   ========================================================= */

.status {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #dff6dd;
    color: #0f6cbd;
}

.status-inactive {
    background: #f8d7da;
    color: #a4262c;
}

.status-warning {
    background: #fff4ce;
    color: #8a6d00;
}


/* =========================================================
   FORM
   ========================================================= */

.form-container {
    background: white;
    border: 1px solid #e1dfdd;
    padding: 25px;
}

.form-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 16px 20px;
    max-width: 800px;
}

.form-label {
    padding-top: 8px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    height: 34px;
    border: 1px solid #c8c6c4;
    border-radius: 2px;
    padding: 7px 10px;
    outline: none;
}

.form-control:focus {
    border-color: #0f6cbd;
    box-shadow: 0 0 0 1px #0f6cbd;
}

textarea.form-control {
    height: 100px;
    resize: vertical;
}

.form-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
}


/* =========================================================
   DASHBOARD (Role Center cue tiles)
   ========================================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.dashboard-card {
    background: white;
    border: 1px solid #e1dfdd;
    border-left: 4px solid #0f6cbd;
    padding: 18px 20px;
}

.dashboard-card:nth-child(4n+2) {
    border-left-color: #038387;
}

.dashboard-card:nth-child(4n+3) {
    border-left-color: #8764b8;
}

.dashboard-card:nth-child(4n+4) {
    border-left-color: #ca5010;
}

.dashboard-card-title {
    color: #616161;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.dashboard-card-value {
    margin-top: 10px;
    font-size: 30px;
}

.dashboard-card-link {
    display: block;
    margin-top: 14px;
    color: #0f6cbd;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.dashboard-card-link:hover {
    text-decoration: underline;
}


/* =========================================================
   ALERT
   ========================================================= */

.alert {
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid transparent;
}

.alert-success {
    background: #dff6dd;
    border-color: #a8d5a2;
    color: #0f6cbd;
}

.alert-error {
    background: #fde7e9;
    border-color: #f1b8bb;
    color: #a4262c;
}

.alert-warning {
    background: #fff4ce;
    border-color: #f3df9b;
    color: #8a6d00;
}


/* =========================================================
   PAGINATION
   ========================================================= */

.pagination {
    display: flex;
    gap: 5px;
    margin-top: 15px;
}

.pagination button {
    min-width: 34px;
    height: 34px;
    border: 1px solid #c8c6c4;
    background: white;
}

.pagination button:hover {
    background: #f3f2f1;
}

.pagination button.active {
    background: #0f6cbd;
    color: white;
    border-color: #0f6cbd;
}


/* =========================================================
   MODAL
   ========================================================= */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    width: 500px;
    max-width: 90%;
    border: 1px solid #c8c6c4;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e1dfdd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e1dfdd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {

    .topbar-search {
        display: none;
    }

    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {

    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 68px 15px 30px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .search-box {
        width: 100%;
    }

    .toolbar {
        flex-wrap: wrap;
    }
}
