/* ===== Base ===== */
:root {
    --sidebar-width: 240px;
}

body {
    background-color: #f4f6fb;
    color: #1a1d23;
}

/* ===== Login ===== */
.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 16px;
}

/* ===== Navbar ===== */
.navbar-brand {
    letter-spacing: -0.3px;
}
.navbar .nav-link {
    padding: 0.5rem 0.875rem;
    border-radius: 6px;
    transition: background 0.15s;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: rgba(255,255,255,0.12);
}

/* ===== Stat cards ===== */
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== Cards ===== */
.card {
    border-radius: 12px;
}

/* ===== Tables ===== */
.table > :not(caption) > * > th,
.table > :not(caption) > * > td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}
.table thead th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    white-space: nowrap;
}

/* ===== Pagination ===== */
.page-link {
    border-radius: 6px !important;
    margin: 0 2px;
}

/* ===== Modals ===== */
.modal-content {
    border-radius: 14px;
    border: 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

/* ===== Toast container ===== */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.app-toast {
    background: #1a1d23;
    color: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: toastIn 0.25s ease;
}
.app-toast.success { border-left: 4px solid #28a745; }
.app-toast.danger  { border-left: 4px solid #dc3545; }
.app-toast.warning { border-left: 4px solid #ffc107; }
.app-toast.info    { border-left: 4px solid #0dcaf0; }

@keyframes toastIn {
    from { transform: translateX(60px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ===== Color Swatches ===== */
.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.12s, border-color 0.12s;
}
.color-swatch:hover {
    transform: scale(1.18);
}
.color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px #1a1d23, 0 0 0 4px currentColor;
    transform: scale(1.12);
}

/* ===== Machine Cover Image ===== */
.machine-cover {
    width: 100%;
    height: 110px;
    background-size: cover;
    background-position: center;
}
.machine-cover-empty {
    height: 70px;
}

/* ===== Board / Kanban ===== */
.board-container {
    overflow-x: auto;
    min-height: calc(100vh - 180px);
    padding-bottom: 32px;
    align-items: flex-start;
}

.board-column {
    width: 280px;
    min-width: 280px;
}

.board-column-header {
    user-select: none;
}

.board-column-body {
    min-height: 120px;
    transition: background 0.15s;
}

.board-column-body.sortable-drag-over {
    background: #d0e8ff;
}

/* ===== Order Cards ===== */
.order-card {
    cursor: grab;
    border-radius: 10px !important;
    transition: box-shadow 0.15s, transform 0.15s;
    border: 1px solid rgba(0,0,0,0.06) !important;
}
.order-card:active {
    cursor: grabbing;
}
.order-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12) !important;
    transform: translateY(-1px);
}

/* Hover actions overlay */
.order-card-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    gap: 4px;
    z-index: 10;
}
.order-card:hover .order-card-actions {
    display: flex;
}
.order-card-actions .btn {
    padding: 2px 7px;
    font-size: 0.75rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(4px);
    color: #111827;
}
.order-card-actions .btn-focus-family {
    background: #fff !important;
    color: #111827 !important;
    border: 1px solid #111827 !important;
}

/* Sortable states */
.sortable-ghost {
    opacity: 0.4;
    background: #c8e6ff !important;
    border: 2px dashed #0d6efd !important;
}
.sortable-drag {
    opacity: 0.95;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2) !important;
    transform: scale(1.02);
}

/* ===== Parent tasks vs phase subtasks ===== */
.order-card-parent {
    cursor: default !important;
    background: #111827 !important;
    color: #fff !important;
    border: 2px solid #111827 !important;
}
.order-card-parent .card-body,
.order-card-parent code {
    color: #fff;
}
.order-card-parent .text-muted {
    color: rgba(255,255,255,.7) !important;
}

.article-saved-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12);
}
.article-saved-dot.is-saved {
    background: #198754;
}
.article-saved-dot.is-unsaved {
    background: #dc3545;
}
.order-card-parent .article-saved-dot {
    box-shadow: 0 0 0 1px rgba(255,255,255,.45);
}
.order-card-parent .board-article-thumb {
    box-shadow: 0 0 0 1px rgba(255,255,255,.25);
}

.phase-card {
    background: #fff;
    border-radius: 10px !important;
}
.phase-card .order-card-actions,
.order-card-parent .order-card-actions {
    display: flex !important;
}
.board-container.phase-focus .js-board-card:not(.focus-keep) {
    opacity: 0.14;
    filter: grayscale(1);
    pointer-events: none;
    transform: none !important;
}
.board-container.article-expand .js-board-card:not(.article-expand-keep) {
    opacity: 0.14;
    filter: grayscale(1);
    pointer-events: none;
    transform: none !important;
}
.board-container.article-expand .js-board-card.article-expand-keep {
    opacity: 1;
    filter: none;
    box-shadow: 0 0 0 3px #0d6efd, 0 8px 24px rgba(0,0,0,.18) !important;
    z-index: 3;
}
.article-grouped-hidden {
    display: none !important;
}
.article-group-card {
    cursor: pointer;
    border-radius: 10px !important;
    border: 2px solid #7c3aed !important;
    background: #faf7ff;
    box-shadow:
        0 1px 0 #e9ddff,
        4px 4px 0 -1px #fff,
        4px 4px 0 0 #c4b5fd,
        8px 8px 0 -1px #fff,
        8px 8px 0 0 #ddd6fe;
    position: relative;
    z-index: 1;
}
.article-group-card .card-body {
    overflow: hidden;
}
.article-group-card:hover {
    transform: translateY(-1px);
    box-shadow:
        0 6px 16px rgba(124,58,237,.18),
        4px 4px 0 -1px #fff,
        4px 4px 0 0 #c4b5fd,
        8px 8px 0 -1px #fff,
        8px 8px 0 0 #ddd6fe;
}
@media print {
    .article-grouped-hidden { display: block !important; }
    .article-group-card, #articleGroupBar, #toggleArticleGroupsBtn { display: none !important; }
    .board-container.article-expand .js-board-card { opacity: 1 !important; filter: none !important; }
}

/* ===== Misc ===== */
.min-w-0 { min-width: 0; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .board-column { width: 240px; min-width: 240px; }
    .container-fluid { padding: 0 12px; }
}

/* ===== Footer ===== */
.footer {
    margin-top: 40px;
}
