/* Daily Management System (DMS) Styles */

/* ===== Layout ===== */

.dms-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.dms-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0;
}

.dms-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== KPI Grid ===== */

.dms-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (max-width: 700px) {
    .dms-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .dms-kpi-grid {
        grid-template-columns: 1fr;
    }
}

.dms-kpi-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.dms-kpi-card-warn {
    border-color: #ff9500;
    background: #fff9f0;
}

.dms-kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: #1d1d1f;
    line-height: 1.1;
    margin-bottom: 4px;
}

.dms-kpi-card-warn .dms-kpi-value {
    color: #e67000;
}

.dms-kpi-label {
    font-size: 12px;
    color: #6e6e73;
    font-weight: 500;
}

.dms-kpi-detail {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

/* ===== Tabs ===== */

.dms-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e5e5;
    margin-bottom: 20px;
}

.dms-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #6e6e73;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.dms-tab:hover {
    color: #1d1d1f;
}

.dms-tab.active {
    color: #0071e3;
    border-bottom-color: #0071e3;
}

/* ===== List header ===== */

.dms-list-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

/* ===== Item list ===== */

.dms-list {
    display: grid;
    gap: 12px;
}

.dms-item {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px;
    transition: box-shadow 0.2s;
}

.dms-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dms-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.dms-item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.dms-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.dms-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 6px;
}

.dms-item-meta {
    font-size: 12px;
    color: #6e6e73;
}

.dms-item-notes {
    font-size: 13px;
    color: #3a3a3c;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #f2f2f7;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Badges ===== */

.dms-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Tier badges */
.dms-badge-tier1 {
    background: #e8f0fc;
    color: #0071e3;
}

.dms-badge-tier2 {
    background: #fff3e0;
    color: #e67000;
}

.dms-badge-tier3 {
    background: #fdecea;
    color: #c0392b;
}

/* Priority badges */
.dms-badge-critical {
    background: #fdecea;
    color: #c0392b;
}

.dms-badge-high {
    background: #fff3e0;
    color: #e67000;
}

.dms-badge-medium {
    background: #e8f0fc;
    color: #0071e3;
}

.dms-badge-low {
    background: #e6f9f0;
    color: #1a7a4a;
}

/* Status badges — problems */
.dms-badge-open {
    background: #e8f0fc;
    color: #0071e3;
}

.dms-badge-in_progress {
    background: #fff3e0;
    color: #e67000;
}

.dms-badge-escalated {
    background: #fdecea;
    color: #c0392b;
}

.dms-badge-resolved {
    background: #e6f9f0;
    color: #1a7a4a;
}

/* Status badges — meetings */
.dms-badge-scheduled {
    background: #f2f2f7;
    color: #6e6e73;
}

.dms-badge-completed {
    background: #e6f9f0;
    color: #1a7a4a;
}

.dms-badge-cancelled {
    background: #fdecea;
    color: #c0392b;
}

/* Category badge */
.dms-badge-category {
    background: #f2f2f7;
    color: #3a3a3c;
}

/* ===== Buttons ===== */

.dms-btn {
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    white-space: nowrap;
}

.dms-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dms-btn-primary {
    background: #0071e3;
    color: white;
}

.dms-btn-primary:hover:not(:disabled) {
    background: #0058b0;
}

.dms-btn-secondary {
    background: #f2f2f7;
    color: #1d1d1f;
}

.dms-btn-secondary:hover:not(:disabled) {
    background: #e5e5ea;
}

.dms-btn-danger {
    background: #ff3b30;
    color: white;
}

.dms-btn-danger:hover:not(:disabled) {
    background: #cc2e25;
}

.dms-btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* ===== Empty state ===== */

.dms-empty {
    text-align: center;
    padding: 48px 20px;
    color: #6e6e73;
}

.dms-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    line-height: 1;
}

.dms-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 6px;
}

.dms-empty-text {
    font-size: 13px;
    color: #6e6e73;
}

/* ===== Modal ===== */

.dms-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    box-sizing: border-box;
}

.dms-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.dms-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
    flex-shrink: 0;
}

.dms-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0;
}

.dms-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #6e6e73;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
    line-height: 1;
}

.dms-modal-close:hover {
    background: #f2f2f7;
    color: #1d1d1f;
}

.dms-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.dms-modal-footer {
    padding: 0 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ===== Form ===== */

.dms-form-group {
    margin-bottom: 16px;
    flex: 1;
}

.dms-form-row {
    display: flex;
    gap: 12px;
}

@media (max-width: 480px) {
    .dms-form-row {
        flex-direction: column;
    }
}

.dms-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #3a3a3c;
    margin-bottom: 6px;
}

.dms-required {
    color: #ff3b30;
}

.dms-input,
.dms-select,
.dms-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1d1d1f;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.dms-input:focus,
.dms-select:focus,
.dms-textarea:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.dms-input::placeholder,
.dms-textarea::placeholder {
    color: #aeaeb2;
}

.dms-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236e6e73' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.dms-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* ===== Toast notification ===== */

.dms-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: system-ui, -apple-system, sans-serif;
    color: white;
    background: #1d1d1f;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s;
    max-width: 320px;
    pointer-events: none;
}

.dms-toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.dms-toast-success {
    background: #1c7c4a;
}

.dms-toast-error {
    background: #c0392b;
}
