/*
 * แดชบอร์ดการ์ดหน่วยงาน (manage_categories.php) — โทน bento
 * การ์ด: #ID, ชื่อหน่วยงาน, จำนวนเรื่อง, แถบ level %, ปุ่มแก้ไข — เรียงตามจำนวนเรื่อง
 */

.main__content.categories .cat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
    gap: 18px;
    margin-top: 8px;
}

.cat-card {
    display: flex;
    flex-direction: column;
    padding: 18px 18px 16px;
    background: #fff;
    border: 1px solid #eaecf0;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: box-shadow .15s ease, transform .12s ease, border-color .15s ease;
}
.cat-card:hover {
    box-shadow: 0 12px 28px rgba(16, 24, 40, .10);
    transform: translateY(-2px);
    border-color: #e0e4ea;
}

.cat-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    min-height: 30px;
}
.cat-card__id {
    padding: 3px 9px;
    border-radius: 7px;
    background: #f4f5f7;
    color: #98a2b3;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
}
.cat-card__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #667085;
}
.cat-card__link:hover { background: #eff6ff; color: #1877f2; }
.cat-card__link .icon { width: 16px; height: 16px; fill: currentColor; }

/* ชื่อ (ซ้าย) + ตัวเลขเด่น (ขวา) แถวเดียว */
.cat-card__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.cat-card__name {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #101828;
    line-height: 1.3;
}

.cat-card__count {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1;
    text-decoration: none;
}
.cat-card__count-num {
    font-size: 44px;
    font-weight: 800;
    color: #1877f2;
    line-height: .95;
    letter-spacing: -.02em;
}
.cat-card__count-label {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 700;
    color: #98a2b3;
}
.cat-card__count:hover .cat-card__count-num { color: #1456b8; }

.cat-card__bar { margin-bottom: 16px; }
.cat-card__bar-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #667085;
}
.cat-card__pct { color: #101828; font-weight: 800; }
.cat-card__track {
    height: 8px;
    border-radius: 999px;
    background: #eef0f3;
    overflow: hidden;
}
.cat-card__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #60a5fa, #1877f2);
    transition: width .4s ease;
}

.cat-card__edit {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid #d0d5dd;
    border-radius: 11px;
    background: #fff;
    color: #1877f2;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}
.cat-card__edit:hover {
    background: #f5f9ff;
    border-color: #1877f2;
    transform: translateY(-1px);
}
.cat-card__edit .icon { width: 16px; height: 16px; fill: currentColor; }

/* =========================================================================
   หน่วยงานที่ยังไม่มีเรื่อง (0) -> ตารางสะอาดตามธีม
   ========================================================================= */
.main__content.categories .cat-empty {
    margin-top: 28px;
}
.cat-empty__title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 800;
    color: #475467;
}
.cat-empty__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.cat-empty__table thead th {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #eaecf0;
    color: #667085;
    font-size: 12.5px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}
.cat-empty__table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f2f4f7;
    color: #344054;
    font-size: 14px;
    vertical-align: middle;
}
.cat-empty__table tbody tr:last-child td { border-bottom: 0; }
.cat-empty__table tbody tr:hover td { background: #f9fbff; }
.cat-empty__id { color: #98a2b3; font-weight: 800; width: 70px; }
.cat-empty__name { font-weight: 600; color: #1d2939; }
.cat-empty__count { color: #98a2b3; font-weight: 700; width: 80px; }
.cat-empty__act { width: 110px; text-align: right; }
.cat-empty__edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: #fff;
    color: #1877f2;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease;
}
.cat-empty__edit:hover { background: #f5f9ff; border-color: #1877f2; }
.cat-empty__edit .icon { width: 14px; height: 14px; fill: currentColor; }

/* =========================================================================
   ช่องค้นหาหน่วยงาน (พิมพ์กรองการ์ด/ตาราง) — สไตล์ action-search-bar
   ========================================================================= */
.main__content.categories .cat-search {
    position: relative;
    margin: 4px 0 18px;
}
.cat-search__input {
    width: 100%;
    max-width: 420px;
    min-height: 46px;
    padding: 11px 14px 11px 42px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 14px center;
    color: #1d2939;
    font-family: inherit;
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.cat-search__input::placeholder { color: #98a2b3; }
.cat-search__input:focus {
    outline: 0;
    border-color: #1877f2;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, .15);
}
.cat-search__empty {
    display: inline-block;
    margin-top: 12px;
    color: #98a2b3;
    font-size: 14px;
}
