* {
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    margin: 0;
    background: #f6f7fb;
    color: #111;
}

/* GLOBAL HIDE */
.hidden {
    display: none !important;
}

/* TOPBAR */
.topbar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 16px 20px;
    background: #0b5cff;
    color: white;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Hamburger */
.menu-btn {
    font-size: 24px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    margin-right: 5px;
}

/* Logos */
.brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    height: 45px;
    width: auto;
}

.login-card .brand-logo {
    height: 60px;
}

.login-logos {
    justify-content: center;
    margin-bottom: 10px;
}

/* Search right */
.topbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}

/* Search box with icon */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border-radius: 10px;
    padding: 0 12px;
    min-width: 420px;
    max-width: 100%;
}

.search-icon {
    font-size: 16px;
    color: #666;
    flex-shrink: 0;
}

/* LAYOUT */
.container {
    max-width: 1380px;
    margin: 18px auto;
    padding: 0 16px 24px;
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
}

.dashboard.with-panel {
    grid-template-columns: 300px 1fr;
}

/* SIDE PANEL */
.side-panel {
    width: 300px;
    background: white;
    position: sticky;
    top: 86px;
}

.side-panel.hidden {
    display: none !important;
}

/* CONTENT */
.content-panel {
    display: grid;
    gap: 16px;
}

/* CARDS */
.card {
    background: white;
    padding: 16px;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

h2, h3 {
    margin: 0 0 12px;
}

/* GRID */
.grid {
    display: grid;
    gap: 10px;
}

.one-col {
    grid-template-columns: 1fr;
}

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

/* INPUTS */
input, select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d0d7e2;
    width: 100%;
    background: white;
}

/* Search input */
#search {
    width: 420px;
    max-width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px 0;
    color: #111;
}

/* ROW */
.row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

.wrap {
    flex-wrap: wrap;
}

.space-between {
    justify-content: space-between;
}

.block-msg {
    display: block;
    margin-top: 10px;
}

/* BUTTONS */
button {
    padding: 10px 14px;
    border-radius: 10px;
    border: 0;
    background: #0b5cff;
    color: white;
    cursor: pointer;
}

button.secondary {
    background: #e8edf7;
    color: #111;
}

button:hover {
    opacity: 0.96;
}

.muted {
    opacity: 0.82;
    font-size: 13px;
}

/* TABLE */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: #fff;
}

th, td {
    padding: 12px 10px;
    border-bottom: 1px solid #eef0f5;
    text-align: left;
    vertical-align: top;
}

tbody tr:hover {
    background: #f8faff;
}

/* ACTIONS */
.action-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    position: relative;
}

/* 3-DOTS BUTTON */
.three-dots-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    border: 0;
    background: #e8edf7;
    color: #111;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.three-dots-btn:hover {
    background: #dbe4f2;
    opacity: 1;
}

/* HISTORY DROPDOWN */
.item-history-dropdown {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    background: #f8faff;
    border: 1px solid #dfe6f2;
    border-radius: 12px;
    display: grid;
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.03);
}

/* Scrollbar */
.item-history-dropdown::-webkit-scrollbar {
    width: 6px;
}

.item-history-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.item-history-dropdown::-webkit-scrollbar-thumb {
    background: #cfd8e3;
    border-radius: 6px;
}

.item-history-dropdown::-webkit-scrollbar-thumb:hover {
    background: #aab7c7;
}

/* HISTORY CARD */
.history-card {
    background: white;
    border: 1px solid #e4ebf5;
    border-left: 4px solid #0b5cff;
    border-radius: 10px;
    padding: 10px 12px;
    display: grid;
    gap: 4px;
    font-size: 13px;
}

/* HISTORY TEXT */
.history-row {
    font-size: 13px;
    color: #111;
    line-height: 1.3;
}

.history-meta {
    font-size: 12px;
    color: #6b7280;
}

/* IMAGE */
.history-image-wrap {
    margin-top: 4px;
}

.history-thumb {
    width: 100px;
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid #d0d7e2;
    display: block;
    cursor: pointer;
}

/* EMPTY */
.history-empty {
    text-align: center;
    padding: 20px 10px;
    font-size: 13px;
    color: #6b7280;
    border: 1px dashed #cfd8e3;
    border-radius: 10px;
    background: #ffffff;
}

.history-loading {
    font-size: 13px;
    color: #6b7280;
    padding: 8px 2px;
}

.history-no-image {
    font-size: 12px;
    color: #666;
}

.history-error {
    display: none;
}

/* MODAL */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 20;
}

.modal.hidden {
    display: none !important;
}

.modal-card {
    width: min(680px, 100%);
    background: white;
    padding: 18px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.wide-modal {
    width: min(960px, 100%);
}

.login-card {
    width: min(560px, 100%);
}

/* DROPDOWN */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-toggle {
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.action-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid #dfe6f2;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    padding: 6px;
    z-index: 30;
}

.action-dropdown-menu.hidden {
    display: none !important;
}

.action-dropdown-item {
    width: 100%;
    text-align: left;
    background: #fff;
    color: #111;
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
}

.action-dropdown-item:hover {
    background: #eef4ff;
}

.caret-small {
    font-size: 16px;
    margin-left: 8px;
}

/* ACCORDION / DETAILS */
.accordion {
    display: grid;
    gap: 12px;
}

.accordion-item {
    border: 1px solid #e4ebf5;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.accordion-header {
    width: 100%;
    background: #f8faff;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    border-radius: 0;
}

.accordion-header:hover {
    background: #eef4ff;
    opacity: 1;
}

.accordion-header.active {
    background: #eaf2ff;
}

.accordion-content {
    padding: 14px 16px;
    border-top: 1px solid #eef0f5;
}

.detail-box {
    background: #fff;
}

.detail-image {
    display: block;
    max-width: 220px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid #d0d7e2;
    margin-top: 10px;
}

/* HISTORY TABLE IN DETAILS MODAL */
.history-section-box {
    display: grid;
    gap: 12px;
}

.history-header-row {
    margin-top: 0;
}

.history-table-wrapper {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e4ebf5;
    border-radius: 10px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef0f5;
    text-align: left;
    font-size: 13px;
    vertical-align: top;
}

.history-table thead th {
    position: sticky;
    top: 0;
    background: #f8faff;
    z-index: 1;
}

.history-table-wrapper::-webkit-scrollbar {
    width: 6px;
}

.history-table-wrapper::-webkit-scrollbar-thumb {
    background: #cfd8e3;
    border-radius: 6px;
}

.history-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #aab7c7;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

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

    .side-panel {
        position: static;
        width: 100%;
    }
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .topbar-right {
        margin-left: 0;
        width: 100%;
    }

    .search-box {
        min-width: 100%;
        width: 100%;
    }

    #search {
        width: 100%;
    }
}