/* 주식 계산기 모음 v2.2.0 — 테마 글꼴을 그대로 쓰고, 색은 아래 변수로 바꿀 수 있어요 */
.apc-root {
	--apc-accent: #2b59ff;
	--apc-up: #e5322d;      /* 상승 = 빨강 (국내 표기) */
	--apc-down: #1e63e9;    /* 하락 = 파랑 */
	--apc-text: #1a1d23;
	--apc-muted: #6b7280;
	--apc-line: #e3e6eb;
	--apc-bg: #ffffff;
	--apc-soft: #f5f7fa;
	--apc-radius: 12px;

	box-sizing: border-box;
	max-width: 680px;
	margin: 1.5em auto;
	padding: 20px;
	background: var(--apc-bg);
	color: var(--apc-text);
	border: 1px solid var(--apc-line);
	border-radius: calc(var(--apc-radius) + 4px);
	font: inherit;
	line-height: 1.5;
}
.apc-root *, .apc-root *::before, .apc-root *::after { box-sizing: border-box; }

/* 통화 전환 (원화 / 달러) */
.apc-cur { display: flex; justify-content: flex-end; gap: 0; margin: 0 0 12px; }
.apc-cur__btn {
	min-height: 34px; padding: 6px 14px; border: 1px solid var(--apc-line); background: var(--apc-bg); color: var(--apc-muted);
	font: inherit; font-size: .86em; font-weight: 700; cursor: pointer; line-height: 1;
}
.apc-cur__btn:first-child { border-radius: 999px 0 0 999px; }
.apc-cur__btn:last-child { border-radius: 0 999px 999px 0; margin-left: -1px; }
.apc-cur__btn[aria-pressed="true"] { position: relative; background: var(--apc-text); border-color: var(--apc-text); color: #fff; }
.apc-cur__btn:hover:not([aria-pressed="true"]) { color: var(--apc-text); }

/* 탭 */
.apc-tabs { display: flex; gap: 4px; padding: 4px; background: var(--apc-soft); border-radius: var(--apc-radius); margin-bottom: 16px; }
.apc-tab {
	flex: 1; min-height: 40px; padding: 8px 12px; border: 0; border-radius: calc(var(--apc-radius) - 4px);
	background: transparent; color: var(--apc-muted); font: inherit; font-weight: 600; cursor: pointer;
}
.apc-tab.is-active { background: var(--apc-bg); color: var(--apc-text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.apc-root button:focus-visible { outline: 2px solid var(--apc-accent); outline-offset: 2px; }

.apc-desc { margin: 0 0 14px; color: var(--apc-muted); font-size: .92em; }

/* 입력 */
.apc-root input, .apc-root select {
	width: 100%; min-height: 44px; padding: 10px 12px; margin: 0;
	border: 1px solid var(--apc-line); border-radius: var(--apc-radius);
	background: var(--apc-bg); color: var(--apc-text);
	font: inherit; font-size: 16px; /* iOS 확대 방지 */
	font-variant-numeric: tabular-nums;
	-webkit-appearance: none; appearance: none;
}
.apc-root input { text-align: right; }
.apc-root select {
	padding-right: 36px; cursor: pointer;
	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 d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 14px center;
}
.apc-root input::placeholder { color: var(--apc-muted); opacity: .7; text-align: left; }
.apc-root input:focus, .apc-root select:focus { outline: none; border-color: var(--apc-accent); box-shadow: 0 0 0 3px rgba(43, 89, 255, .16); }

.apc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.apc-field { display: block; margin: 0 0 12px; min-width: 0; }
.apc-field--full { grid-column: 1 / -1; }
.apc-field > span, .apc-card-grid label > span { display: block; font-size: .82em; color: var(--apc-muted); font-weight: 600; margin-bottom: 6px; }
.apc-field small { display: block; margin-top: 4px; font-size: .76em; color: var(--apc-muted); line-height: 1.4; }

/* 여러 줄 입력 */
.apc-rows-head, .apc-row--avg { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 8px; }
.apc-rows-head { font-size: .82em; color: var(--apc-muted); font-weight: 600; margin-bottom: 6px; padding: 0 2px; }
.apc-row { margin-bottom: 8px; }
.apc-row--trade { position: relative; padding: 14px 14px 12px; border: 1px solid var(--apc-line); border-radius: var(--apc-radius); background: var(--apc-soft); margin-bottom: 10px; }
.apc-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-right: 36px; }
.apc-row-out { display: flex; flex-direction: column; justify-content: flex-end; font-size: .82em; color: var(--apc-muted); font-weight: 600; }
.apc-row-out b { font-size: 1.15em; color: var(--apc-text); font-variant-numeric: tabular-nums; padding-bottom: 10px; }

.apc-remove {
	min-height: 44px; border: 1px solid var(--apc-line); border-radius: var(--apc-radius);
	background: var(--apc-bg); color: var(--apc-muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0;
}
.apc-remove--card { position: absolute; top: 10px; right: 10px; width: 32px; min-height: 32px; font-size: 18px; }
.apc-remove:hover:not(:disabled) { color: var(--apc-up); border-color: currentColor; }
.apc-remove:disabled { opacity: .35; cursor: default; }

.apc-add {
	width: 100%; min-height: 44px; margin: 2px 0 16px; border: 1px dashed var(--apc-line); border-radius: var(--apc-radius);
	background: transparent; color: var(--apc-accent); font: inherit; font-weight: 600; cursor: pointer;
}
.apc-add:hover { background: var(--apc-soft); }

/* 결과 */
.apc-result { margin-top: 4px; padding: 16px; background: var(--apc-soft); border-radius: var(--apc-radius); }
.apc-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--apc-line); }
.apc-main span { color: var(--apc-muted); font-weight: 600; }
.apc-main strong { font-size: 1.6em; font-weight: 800; color: var(--apc-accent); font-variant-numeric: tabular-nums; word-break: keep-all; }
.apc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 20px; margin: 12px 0 0; }
.apc-grid > div { display: flex; justify-content: space-between; gap: 8px; }
.apc-grid dt { color: var(--apc-muted); font-size: .9em; margin: 0; }
.apc-grid dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.apc-root .is-up { color: var(--apc-up); }
.apc-root .is-down { color: var(--apc-down); }
.apc-msg { margin: 12px 0 0; font-size: .88em; color: var(--apc-muted); }
.apc-msg:empty { display: none; }

.apc-table-wrap:empty { display: none; }
.apc-table-wrap { margin-top: 14px; max-height: 320px; overflow: auto; border-radius: 8px; border: 1px solid var(--apc-line); background: var(--apc-bg); }
.apc-table { width: 100%; border-collapse: collapse; font-size: .86em; font-variant-numeric: tabular-nums; margin: 0; }
.apc-table th, .apc-table td { padding: 8px 10px; text-align: right; border: 0; border-bottom: 1px solid var(--apc-line); white-space: nowrap; }
.apc-table th:first-child, .apc-table td:first-child { text-align: left; }
.apc-table thead th { position: sticky; top: 0; background: var(--apc-bg); color: var(--apc-muted); font-weight: 600; }

.apc-reset {
	display: block; margin: 12px 0 0 auto; padding: 6px 4px; border: 0; background: none;
	color: var(--apc-muted); font: inherit; font-size: .88em; text-decoration: underline; cursor: pointer;
}
.apc-note { margin: 14px 0 0; font-size: .78em; color: var(--apc-muted); text-align: center; }

@media (max-width: 520px) {
	.apc-root { padding: 16px; border-radius: var(--apc-radius); }
	.apc-fields { grid-template-columns: 1fr; }
	.apc-card-grid { grid-template-columns: 1fr 1fr; }
	.apc-main strong { font-size: 1.35em; }
	.apc-grid { grid-template-columns: 1fr; }
}

/* 계산기 목록 카드 [stock_calc_list] */
.apc-cards { list-style: none; margin: 1.5em 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.apc-cards li { margin: 0; padding: 0; }
.apc-card {
	display: flex; gap: 14px; align-items: flex-start; height: 100%; padding: 18px;
	border: 1px solid #e3e6eb; border-radius: 14px; background: #fff; color: #1a1d23; text-decoration: none;
	transition: border-color .15s, box-shadow .15s, transform .15s;
}
.apc-card:hover, .apc-card:focus-visible { border-color: #2b59ff; box-shadow: 0 6px 18px rgba(43, 89, 255, .1); transform: translateY(-1px); }
.apc-card__icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #f0f3ff; font-size: 22px; }
.apc-card__body { display: flex; flex-direction: column; gap: 4px; }
.apc-card__body strong { font-size: 1.05em; }
.apc-card__body span { font-size: .88em; color: #6b7280; line-height: 1.45; }
