/* Hardware Calendar Plan styles */
.hw-cal-modal {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: center; justify-content: center;
    z-index: 9999;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100vw !important;
    height: 100vh !important;
}
.hw-cal-modal[style*="display: flex"], .hw-cal-modal[style*="display:flex"] {
    display: flex !important;
}
.hw-cal-modal .modal-content.hw-cal-content {
    background: #fff;
    width: calc(100vw - 16px) !important;
    height: calc(100vh - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    margin: 8px !important;
    padding: 0 !important;
    border-radius: 10px;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}
.hw-cal-header {
    padding: 10px 14px; border-bottom: 1px solid #e5e7eb;
    display: flex; flex-direction: column; gap: 6px;
    flex-shrink: 0;
}
.hw-cal-header h3 { margin: 0; font-size: 17px; }
.hw-cal-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px;
}
.hw-cal-toolbar input[type="date"] {
    padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 6px;
}
.hw-cal-legend { display: flex; gap: 14px; margin-left: auto; }
.hw-cal-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.hw-cal-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.hw-cal-close { margin-left: 8px; }

.hw-cal-body {
    flex: 1; overflow: hidden; position: relative; background: #fafafa;
    min-height: 0;
}
.hw-cal-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: #6b7280; font-size: 14px;
}

.hw-cal-wrapper {
    display: grid;
    grid-template-columns: 440px 1fr;
    grid-template-rows: 90px 1fr;
    width: 100%;
    height: 100%;
}
.hw-cal-corner {
    grid-row: 1; grid-column: 1;
    display: grid; grid-template-columns: 60px 240px 140px;
    align-items: end;
    background: #f3f4f6;
    border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb;
    z-index: 3;
}
.hw-cal-corner-cell {
    padding: 8px 10px; font-weight: 600; font-size: 12px; color: #374151;
    border-left: 1px solid #e5e7eb; height: 100%; display: flex; align-items: flex-end;
}
.hw-cal-corner-cell:first-child { border-left: 0; }

.hw-cal-head-scroll {
    grid-row: 1; grid-column: 2;
    overflow: hidden;
    background: #f3f4f6; border-bottom: 1px solid #e5e7eb;
}
.hw-cal-head { display: flex; flex-direction: column; }
.hw-cal-head-row { display: flex; }
.hw-cal-cell-year, .hw-cal-cell-month, .hw-cal-cell-day {
    border-left: 1px solid #e5e7eb; box-sizing: border-box;
    text-align: center; font-size: 12px; color: #374151; user-select: none;
}
.hw-cal-cell-year   { height: 26px; line-height: 26px; font-weight: 700; background: #e5e7eb; }
.hw-cal-cell-month  { height: 28px; line-height: 28px; font-weight: 600; background: #eef2f7; }
.hw-cal-cell-day    { height: 36px; line-height: 36px; font-size: 11px; }
.hw-cal-cell-day.is-weekend { background: #fff7ed; color: #9a3412; }

.hw-cal-side {
    grid-row: 2; grid-column: 1;
    overflow: hidden;
    background: #fff; border-right: 1px solid #e5e7eb;
}
.hw-cal-side-row {
    display: grid; grid-template-columns: 60px 240px 140px;
    border-bottom: 1px solid #f1f5f9; align-items: center;
}
.hw-cal-c-num   { padding: 0 8px; text-align: center; color: #6b7280; font-size: 12px; }
.hw-cal-c-fio   { padding: 0 10px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-cal-c-method{ padding: 0 8px; }
.hw-cal-badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    color: #fff; font-size: 11px; font-weight: 600;
}

.hw-cal-grid-scroll {
    grid-row: 2; grid-column: 2;
    overflow: auto; background: #fff;
}
.hw-cal-grid-inner { position: relative; }
.hw-cal-grid-row {
    position: relative; display: flex; border-bottom: 1px solid #f1f5f9;
}
.hw-cal-bg-cell {
    height: 100%; border-left: 1px solid #f3f4f6; box-sizing: border-box;
}
.hw-cal-bg-cell.is-weekend { background: #fff7ed; }
.hw-cal-today {
    position: absolute; top: 0; bottom: 0; width: 2px;
    background: #ef4444; z-index: 2; pointer-events: none;
}
.hw-cal-seg {
    position: absolute; top: 8px; height: 20px; border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18);
    cursor: pointer; opacity: 0.92; transition: opacity .15s;
    z-index: 3;
}
.hw-cal-seg:hover { opacity: 1; }
.hw-cal-tip {
    position: fixed; display: none; background: #111827; color: #fff;
    padding: 8px 10px; border-radius: 6px; font-size: 12px; line-height: 1.4;
    white-space: pre-line; pointer-events: none; z-index: 10001;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* Filter buttons (legend = filters) */
.hw-cal-legend { gap: 8px; }
.hw-cal-flt {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; font-size: 12px; font-weight: 500;
    background: #fff; color: #6b7280;
    border: 1px solid #d1d5db; border-radius: 999px;
    cursor: pointer; user-select: none;
    transition: all .15s;
}
.hw-cal-flt i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; opacity: .35; transition: opacity .15s; }
.hw-cal-flt:hover { background: #f3f4f6; color: #111827; }
.hw-cal-flt.is-active { background: #111827; color: #fff; border-color: #111827; }
.hw-cal-flt.is-active i { opacity: 1; }
.hw-cal-flt-all { font-weight: 600; }
.hw-cal-flt-all.is-active { background: #2563eb; border-color: #2563eb; color: #fff; }
