/* =====================================================
   Flamingo records common
===================================================== */
#ct-wrap *, #rf-wrap *, #roast-stats * { box-sizing: border-box; }
#ct-wrap, #rf-wrap, #roast-stats { font-family: inherit; margin-bottom: 24px; }

/* =====================================================
   Coffee tasting list
===================================================== */
#ct-bar,
#rf-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    background: #f7f6f3;
    border: 1px solid #e0ddd6;
    border-radius: 10px;
    margin-bottom: 10px;
    align-items: flex-end;
}
.ct-group,
.rf-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}
.ct-group label,
.rf-group label {
    font-size: 11px;
    color: #999;
    margin: 0;
    font-weight: normal;
}
#ct-wrap select,
#ct-wrap input[type="date"],
#rf-wrap select,
#rf-wrap input[type="date"] {
    font-size: 13px;
    padding: 5px 8px;
    border: 1px solid #d0cec6;
    border-radius: 6px;
    background: #fff;
    color: #222;
    width: 100%;
    height: 32px;
}
.ct-action-row,
.rf-action-row {
    display: flex;
    gap: 6px;
    align-self: flex-end;
}
#ct-reset,
#rf-reset {
    font-size: 13px;
    padding: 5px 14px;
    height: 32px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
}
#ct-reset:hover,
#rf-reset:hover { background: #f0efe9; }
#ct-search,
#rf-search {
    font-size: 13px;
    padding: 5px 18px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #222;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}
#ct-search:hover,
#rf-search:hover { background: #444; }
#ct-meta,
#rf-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
#ct-count,
#rf-count { font-size: 12px; color: #aaa; }
.ct-hidden,
.rf-hidden { display: none !important; }
.coffee-record {
    background: #fff;
    border: 1px solid #e0ddd6;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 12px;
    position: relative;
}
.ct-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0ddd6;
}
.ct-date { font-size: 18px; font-weight: 500; color: #1a1a1a; letter-spacing: 0.02em; }
.ct-stars-wrap,
.ct-rating-stars { display: flex; gap: 3px; flex-shrink: 0; }
.ct-star-h,
.ct-rating-star { width: 11px; height: 11px; background: #BA7517; border-radius: 1px; }
.ct-star-h.off,
.ct-rating-star.off { background: #e0ddd6; }
.ct-country { font-size: 15px; font-weight: 500; color: #1a1a1a; margin: 0 0 3px; }
.ct-sub { font-size: 12px; color: #999; margin: 0 0 14px; line-height: 1.7; }
.ct-section-label { font-size: 10px; color: #aaa; letter-spacing: 0.06em; margin: 14px 0 6px; text-transform: uppercase; }
.ct-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ct-table tr { border-bottom: 1px solid #f0efe9; }
.ct-table tr:last-child { border-bottom: none; }
.ct-table td { padding: 6px 0; vertical-align: top; }
.ct-table td:first-child { color: #aaa; font-size: 11px; white-space: nowrap; width: 8rem; padding-right: 12px; }
.ct-table td:last-child { color: #555; }
.ct-memo { font-size: 13px; color: #666; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e0ddd6; line-height: 1.7; font-style: italic; }
.ct-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.ct-inputer { font-size: 11px; color: #aaa; }
.ct-edit-btn,
.rf-edit-btn {
    font-size: 12px;
    padding: 4px 12px;
    border: 1px solid #d0cec6;
    border-radius: 6px;
    background: #fff;
    color: #555;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.ct-edit-btn:hover,
.rf-edit-btn:hover { background: #f7f6f3; }
#ct-modal-overlay,
#rf-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.45);
    align-items: center;
    justify-content: center;
}
#ct-modal-overlay.open,
#rf-modal-overlay.open { display: flex; }
#ct-modal,
#rf-modal {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}
#ct-modal { max-width: 560px; }
#rf-modal { max-width: 520px; }
#ct-modal h3,
#rf-modal h3 { margin: 0 0 16px; font-size: 16px; color: #1a1a1a; }
.ct-field,
.rf-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.ct-field label,
.rf-field label { font-size: 12px; color: #888; }
.ct-field input[type="text"],
.ct-field input[type="date"],
.ct-field textarea,
.rf-field input[type="text"],
.rf-field input[type="date"],
.rf-field textarea {
    font-size: 14px;
    padding: 7px 10px;
    border: 1px solid #d0cec6;
    border-radius: 6px;
    background: #fff;
    color: #222;
    width: 100%;
    font-family: inherit;
}
.ct-field textarea,
.rf-field textarea { min-height: 70px; resize: vertical; }
.rf-field textarea { min-height: 80px; }
.ct-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ct-modal-actions,
.rf-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.ct-save-btn,
.rf-save-btn { font-size: 13px; padding: 7px 20px; background: #1a1a1a; color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.ct-save-btn:hover,
.rf-save-btn:hover { background: #333; }
.ct-cancel-btn,
.rf-cancel-btn { font-size: 13px; padding: 7px 16px; background: #fff; color: #666; border: 1px solid #ccc; border-radius: 6px; cursor: pointer; }
.ct-cancel-btn:hover,
.rf-cancel-btn:hover { background: #f7f6f3; }
#ct-saved-msg,
#rf-saved-msg { display: none; background: #E1F5EE; color: #0F6E56; border: 1px solid #9FE1CB; border-radius: 8px; padding: 10px 16px; margin-bottom: 14px; font-size: 13px; }
#ct-saved-msg.show,
#rf-saved-msg.show { display: block; }

/* =====================================================
   Roast list
===================================================== */
.rf-view-btns { display: flex; gap: 6px; }
.rf-view-btn { font-size: 12px; padding: 4px 12px; border: 1px solid #d0cec6; border-radius: 6px; background: #fff; color: #666; cursor: pointer; }
.rf-view-btn.active { background: #222; color: #fff; border-color: #222; }
#rf-cards .roast-record { border: 1px solid #ddd; padding: 16px; margin-bottom: 16px; border-radius: 8px; background: #fff; position: relative; }
#rf-cards .roast-record h3 { margin-top: 0; margin-bottom: 10px; font-size: 15px; }
#rf-cards .roast-record p { margin: 4px 0; font-size: 14px; }
#rf-cards .rf-edit-btn { position: absolute; top: 14px; right: 14px; }
#rf-table-wrap { overflow-x: auto; display: none; }
#rf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#rf-table th { background: #f7f6f3; border-bottom: 2px solid #e0ddd6; padding: 8px 10px; text-align: left; white-space: nowrap; font-weight: 600; color: #444; }
#rf-table td { border-bottom: 1px solid #eee; padding: 8px 10px; vertical-align: top; color: #333; }
#rf-table tr:last-child td { border-bottom: none; }
#rf-table tr:hover td { background: #fafaf8; }
#rf-table .td-memo { max-width: 180px; white-space: pre-wrap; word-break: break-all; font-size: 12px; color: #666; }
#rf-table .td-num { text-align: right; white-space: nowrap; }
#rf-table .rf-edit-btn { position: static; }

/* =====================================================
   Roast stats
===================================================== */
#roast-stats { margin-bottom: 32px; }
.rs-main-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 12px; }
.rs-card { background: #fff; border: 1px solid #e0ddd6; border-radius: 12px; padding: 18px 16px 12px; position: relative; overflow: hidden; }
.rs-card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; border-radius: 0 0 12px 12px; }
.rs-label { font-size: 11px; color: #999; margin: 0 0 6px; letter-spacing: 0.03em; }
.rs-value { font-size: 28px; font-weight: 700; color: #1a1a1a; line-height: 1; margin: 0 0 2px; }
.rs-unit { font-size: 14px; font-weight: 400; color: #888; }
.rs-sub { font-size: 11px; color: #bbb; margin: 4px 0 10px; }
.rs-bar-track { background: #ece9e3; border-radius: 99px; height: 6px; overflow: hidden; }
.rs-bar-fill { height: 100%; border-radius: 99px; width: 0%; transition: width 1.4s cubic-bezier(.4,0,.2,1); }
.rs-card.ca .rs-bar-fill { background: #1D9E75; }
.rs-card.cb .rs-bar-fill { background: #BA7517; }
.rs-bar-max { font-size: 10px; color: #ccc; text-align: right; margin-top: 3px; }
.rs-mid-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.rs-mid-card,
.rs-sub-card { background: #fff; border: 1px solid #e0ddd6; border-radius: 12px; padding: 14px 16px; }
.rs-mid-card { text-align: center; }
.rs-mid-label,
.rs-sub-label { font-size: 11px; color: #999; margin: 0 0 8px; letter-spacing: 0.03em; }
.rs-mid-val { font-size: 28px; font-weight: 700; color: #1a1a1a; line-height: 1; }
.rs-mid-unit { font-size: 13px; font-weight: 400; color: #888; }
.rs-streak-fire { font-size: 20px; display: block; margin-bottom: 4px; }
.rs-sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rs-sub-grid > :nth-child(3) {
  grid-column: 2;
  grid-row: 1 / 3;
}
.rs-count-val { font-size: 32px; font-weight: 700; color: #1a1a1a; line-height: 1; margin: 0!important; }
.rs-count-val span { font-size: 13px; color: #888; font-weight: 400; }
.rs-week-range { font-size: 11px; color: #bbb; margin: 8px 0 0; }
.rs-empty { font-size: 13px; color: #bbb; }
.rs-top { list-style: none; margin: 0; padding: 0; }
.rs-top li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0efe9; }
.rs-top li:last-child { border-bottom: none; }
.rs-rank { min-width: 34px; font-size: 11px; font-weight: 700; color: #fff; border-radius: 999px; padding: 2px 7px; text-align: center; background: #aaa; }
.rs-rank.r1 { background: #BA7517; }
.rs-rank.r2 { background: #999; }
.rs-rank.r3 { background: #8A5A32; }
.rs-top-name { flex: 1; font-size: 13px; color: #333; }
.rs-top-count { font-size: 12px; color: #999; }

/* =====================================================
   Pairing list
===================================================== */
.pairing-record { border: 1px solid #ddd; padding: 16px; margin-bottom: 20px; border-radius: 8px; background: #fff; }
.pairing-record h3 { margin-top: 0; margin-bottom: 12px; }
.pairing-record p { margin: 6px 0; }

@media (max-width: 640px) {
    .ct-group,
    .rf-group { min-width: 100%; }
    .ct-modal-grid,
    .rs-main-grid,
    .rs-mid-grid,
    .rs-sub-grid { grid-template-columns: 1fr; }
  .rs-sub-grid {
    grid-template-columns: 1fr;
  }
  .rs-sub-grid > :nth-child(3) {
    grid-column: auto;
    grid-row: auto;
  }
}
