body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    margin: 0;
    padding: 20px;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    /*color: #e65100;*/
    color: #212121;
    margin-bottom: 20px;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
th, td {
    padding: 8px 5px 8px 10px;
    text-align: left;
}

th {
    background-color: #f0f0f5;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 0.05rem;
    text-align: center;
}

td {
    border-bottom: 3px solid #e0e0e0;
    font-size: 1rem;
}

/* 滑鼠移動到上方 */
tr:hover {
    background-color: #e0e0e0;
}

/* 按鈕 */
button {
    padding: 8px 8px;
    border: none;
    border-radius: 8px;
    background-color: #ff5722;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #bf360c;
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.3);
}
button a:link{
    color:  #FFFFFF;
    text-decoration: none;
}
button a:hover{
    color:  #FFFFFF;
    text-decoration: none;
}
button a:active{
    color:  #FFFFFF;
    text-decoration: none;
}
button a:visited{
    color:  #FFFFFF;
    text-decoration: none;
}
/* 按钮的布局调整 */
.button-group {
    display: flex;
    gap: 10px;
}

/* 表單外觀：圓角、淡陰影、淺色背景，維持 Apple 簡約設計 */
form {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

label {
    display: block;
    margin: 10px 0 5px 0;
    font-size: 14px;
    color: #555;
}
/* 輸入框及下拉式選單：維持灰白底，圓角，聚焦時有淡藍邊框 */
input[type="text"], input[type="date"], input[type="number"],select,input[type="password"],input[type="datetime-local"]{
    width: 95%;
    padding: 5px 10px 5px 10px;
    margin-top: 0px;
    border-radius: 8px;
    border: 1px solid #d2d2d7;
    font-size: 16px;
    background-color: #f5f5f5;
    color: #333;
    transition: border-color 0.3s ease;
    font-family: inherit;
    line-height: 2em;
}
table.insidetable input[type="text"],table.insidetable input[type="number"],table.insidetable input[type="date"],{
    width: auto;
}
details table{
    box-shadow: inherit;
    border-radius: 0px;
}
details table input[type="text"]{
    width: 70%;
}
details table input[type="date"]{
    width: 100px;
}
details table tr td:first-child{
    width: 30%;
}
details table tr td:nth-child(2){
    width: 20%;
}
details table tr td:nth-child(3){
    width: 10%;
}
details table tr td:nth-child(6){
    width: 10%;
}
details table tr td:nth-child(7),details table tr td:nth-child(8){
    width: 8%;
}
details summary {
  text-indent: 1em;
  list-style-type: none;
}

/* 隱藏summary元素的三角形圖標 */
/* line 20, ../sass/screen.scss */
details summary::-webkit-details-marker {
  display: none;
}
table#tablelist{
    border-radius: 0px;
    line-height: 2em;
    
}
table#tablelist tr th{
    background-color: #ffab91;
}
table#tablelist tr th:nth-child(1) {
    width: 30%;
}
table#tablelist tr th:nth-child(2) {
    width: 20%;
}
table#tablelist tr th:nth-child(5) {
    width: 10%;
}
table#tablelist tr th:nth-child(7),table#tablelist tr th:nth-child(8) {
    width: 8%;
}
table#categoryTable{

}
table#categoryTable tr td{
    text-align: center;
    width: 22.5%;
}
table#categoryTable tr td:nth-child(1){
    width: 10%;
}
table#categoryTable tr td button[type="button"] {
    margin: 0px 1% 0px 1%;
    float: left;
}
select{
    width: 98.5%;
    padding: 12px 0px 12px 12px;
    margin-top: 8px;
    border-radius: 8px;
    border: 1px solid #d1d1d6;
    font-size: 16px;
    background-color: #f5f5f7;
    transition: border-color 0.3s ease;
}
input[type="text"][name="item_name[]"] {
    width: 70%;
}

input[type="text"]{}
input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: #007aff;
    outline: none;
    background-color: #ffffff;
}
a{
   color: #01579b;
   text-decoration: none; 
   border-right: 1px solid #01579b;
   padding-right: 8px;
}
a:last-child{
    border-right: none;
}
table a,table a:visited{
    color: #FFFFFF;
    background-color: #ff7043;
    line-height: 2em;
    padding: 5px;
    border-radius: 10px;
    text-decoration: none;
}
table a:hover,table a:active{
    background-color: #bdbdbd;
}
input[type="submit"] {
    background-color: #ff7043;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    margin: 20px auto auto auto;
    transition: background-color 0.3s ease;
    font-family: inherit;
}
#checkproductbox{
    font-size: 1em;
}
#checkproductbox span{
    margin:  0px 0px 0px 10px;
    line-height: 2em;
    display: inline-block;
}
#checkproductbox ul {
    margin: 0px;
    padding: 0px;
}
#checkproductbox ul li{
    border-bottom: dotted 1px #bdbdbd;
    list-style: none;
    margin-bottom: 0px;
    padding: 3px;
}
#checkproductbox span:first-child{
    margin:  0px 0px 0px 0px;
}
#checkproductbox label{
    width: 40%;
    display: inline-block;
    
    line-height: 2em;
}
#checkproductbox input{
    width: 10%;
    padding: 0px;
}
#checkproductbox input[type="checkbox"]{
    width: 20px;
    display: inline-block;
}
#checkproductbox input[type="submit"],
#checkproductbox input[type="button"] {
    background-color: #ff7043;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    margin: 20px auto auto auto;
    transition: background-color 0.3s ease;
    font-family: inherit;
}
.detaildate input[name="item_name[]"]:first-of-type {
    width: 75%; /* 只設定第一個符合條件的 input */
}
.detaildate input[name="item_name[]"] {
    width: 75%; /* 設定項目名稱欄位的寬度 */
}
.detaildate button[class="copy-btn"] {
    margin: 0px 10px 0px 10px;
    font-size: 1.2em;
}
.form-group {
    margin-bottom: 20px;
}
.form-section {
    border-top: 1px solid #e0e0e5;
    margin-top: 30px;
    padding-top: 20px;
}
/* 提交與一般按鈕：使用 Apple 常見的藍色，滑過變深藍 */
button[type="submit"],
button[type="button"] {
    background-color: #ff7043;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    margin: 20px auto auto auto;
    transition: background-color 0.3s ease;
    font-family: inherit;
    display: table;
}
input[type="button"] {
    background-color: #ff7043;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    margin: 10px;
    transition: background-color 0.3s ease;
    font-family: inherit;
}

button[type="submit"]:hover,
button[type="button"]:hover {
    background-color: #bf360c;
}
input[type="button"].deleteDetail{
    background-color: #9e9e9e;
    padding: 5px 10px;

}
input[type="button"].clearDetail{
    background-color: #9e9e9e;
    padding: 5px 10px;
}
form.incomeblock{
    width: 100%;
    margin: 0px auto 20px auto;
    box-shadow: none;
    background-color: transparent;
    max-width: 100%;
}
form.incomeblock label{
    width: 80px;
    float: left;
    margin:  0px 10px 0px 10px;
    line-height: 2.2em;
    font-size: 1em;

}
form.incomeblock input[type="date"],form.incomeblock select{
    width: auto;
    display: table;
    float: left;
    padding: 0px 6px 0px 6px;
}
form.incomeblock select{
    padding: 6px;
    margin: 0px 10px 0px 0px;
}
form.incomeblock button{
    margin:  0px 10px 0px 0px;
    padding: 8px 20px 8px 20px;
}
form#categoryForm{
    width: 100%;
    position: fixed;
    top: 25%;
    left: 25%;
    display: none;
}
form#categoryaddForm{
    width: 100%;
    position: fixed;
    top: 25%;
    left: 25%;
    display: none;
    text-align: center;
}
form#categoryaddForm button[type="button"]{
    margin: 0px 2% 0px 2%;
    float: left;
}
#categoryFormblock{
    background-color: #CCCCCC;
    width: 100vw;
    height: 100vh;
    position: fixed;
    left: 0px;
    top: 0px;
    display: none;
}
/* 明細區塊：採用點線分隔，維持簡潔 */
.detaildate {
    border-top: 2px dotted #bcaaa4;
    padding: 20px 10%;
    margin-bottom: 20px;
}

.detaildate label {
    margin-top: 10px;
}
.detail{
    border-top: 2px dotted #bcaaa4;
    padding: 20px 5%;
    margin-bottom: 20px;
}

/* 複製按鈕：同樣維持 Apple 藍色風格 */
button.copy-btn {
    background-color: #ff7043;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: 10px;
    margin-top: 0px;
    float: right;
}

button[type="button"].copy-btn:hover {
    background-color: #bf360c;
}

/* 成功訊息區塊：居中呈現，維持淡色與圓角 */

#successMessage {
    background-color: #eeeeee;
    opacity: 0.95;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 0px 20px 0px 20px;
    max-width: 350px;
    width: 100vw;
    height: 100vh;
    margin: 40px auto 0px auto;
    text-align: center;
    font-size: 14px;
    position: fixed;
    top: 0px;
}

/* 繼續新增與返回列表的按鈕，同風格處理 */
#continueButton, #returnButton {
    background-color: #ff7043;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    margin: 10px 5px 0 5px;
}

#continueButton:hover, #returnButton:hover {
    background-color: #e64a19;
}

/* 總和顯示區：稍微加粗強調 */
#totalAmountblock {
    margin-top: 10px;
    font-weight: 600;
    font-size: 16px;
    color: #3a3a3c;
    text-align: center;
}
.middleblock{
    text-align: center;
    margin: 0px;
}
.alignrightblock{
    float: right;
}
#detailsContainer{
    position: relative;
    overflow-y: auto; /* 讓內容可滾動 */

}
#addDetail {
    background-color: #01579b;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 20px;
    width: auto;
    /* 不設定 width 或 height，保留按鈕原本大小 */
    position: fixed; /* 使用 fixed 讓JS可動態定位 */
    top: 0; 
    left: 0;
    z-index: 9999;
}

#addDetail:hover {
    background-color: #ff7043;
}
/* 使表格在移动设备上更加友好 */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
    }

    th, td {
        padding: 10px;
    }

    h2 {
        font-size: 1.5rem;
    }

    button {
        padding: 6px 12px;
    }
}
@media (max-width: 425px) {
    .close-btn {
        top: 70px;
    }
    #close-btn {
        top: 70px;
    }
}
 /* 弹出 DIV 样式 */
 
#detailsDiv {
    display: none;
    position: absolute;
    top: 50px;
    left: 50px;
    width: 60%;
    background-color: white;
    border: 2px solid #ccc;
    padding: 20px;
    overflow-y: scroll;
    z-index: 1000;
    left: 50%; transform: translateX(-50%);
    border-radius: 8px; 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
/*
#detailsDiv button {
    position: absolute;
    top: 10px;
    right: 10px;
}
*/
 #detailsDiv button.middlebutton {
    position: relative;
    left: -50%;
    bottom: 0px;
    margin-top: 10px;
}
/* 基本選單樣式 */
#navbar {
    position: relative;
}

/* 漢堡選單按鈕 */
.menu-icon {
    font-size: 30px;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: #0d47a1;
    border-radius: 10%;
    padding: 0px 10px 5px 10px;
    color: #FFFFFF;
}
/* 選單內部的樣式 */
fieldset {
    border: none;
    margin: 20px;
    border-bottom: 0px solid #ccc;
}

legend {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    padding: 5px;
    border-bottom: 0px solid #ccc;
    margin-bottom: 0px;
    text-align: center;
    width: 100%;
}
/* 隱藏的選單（預設隱藏） */
.menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #eeeeee;
    transform: translateY(200%); /* 初始狀態隱藏 */
    transition: transform 0.3s ease;
    z-index: 1000; /* 保證選單在上方 */
    overflow-y: auto; /* 使選單內容可滾動 */
    max-height: 100%; /* 限制選單的最大高度 */
}
.menu img{
    fill: #ff7043;
}
.menu img.icon{
    width: 15px;
    height: 15px;
    fill: #ff7043;
}
/* 選單項目的樣式 */
/* 選單項目的樣式 */
.menu ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.menu ul li {
    text-align: center;
    padding: 10px 0;
    border-bottom: 2px solid #eeeeee;
    background-color: #FFFFFF;
    border-radius: 0px;
    /*color: #01579b;*/
}
.menu ul li:last-child {
    border-radius: 0px 0px 15px 15px;
}
.menu ul li:first-child {
    border-radius: 15px 15px 0px 0px;
}

.menu ul li a {
    color: #333;
    text-decoration: none;
    font-size: 16px;
    display: block;
    transition: color 0.3s ease;
}

/* 滑鼠懸停效果 */
.menu ul li a:hover {
    color: #ff5722;
}
.menu ul li ol {
    margin: 0px;
    padding: 0px;
}
.menu ul li ol li{
    list-style-type: disclosure-closed;
    border: none;
    color: #78909c;
    width: 20%;
    margin:  0px auto 0px auto;
}
.menu ul li ol li a{
    color: #78909c;
}
/* 收合按鈕 (X) 固定在頁面最上方 */
#close-btn-container {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1002; /* 確保 X 按鈕在選單之上 */
    padding: 20px;
}

.close-btn {
    font-size: 35px;
    color: #0d47a1;
    cursor: pointer;
    transform: translateY(0%); /* 初始狀態隱藏 */
    position: fixed; /* 使用 fixed 來讓它固定在右上角 */
    top: 30px;
    right: 40px;
    z-index: 1002; /* 確保 X 按鈕在選單之上 */
    display: none;
    transition: opacity 10s ease, visibility 0s linear 0.5s;
}
.menu.show + #close-btn-container .close-btn {
    opacity: 1; /* 顯示 */
    visibility: visible; /* 讓元素可見 */
    transition: opacity 0.5s ease; /* 漸變效果 */
}
/* 當選單顯示時，讓 close-btn 顯示出來 */
.menu.show + #close-btn-container .close-btn {
    opacity: 1; /* 顯示 */
    visibility: visible; /* 讓元素可見 */
    transition: opacity 0.5s ease; /* 漸變效果 */
}
/* 漢堡選單按鈕動畫 */

.menu-icon:hover {
    background-color: #bdbdbd;
    color:  #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* 顯示選單的樣式 */
.menu.show {
    transform: translateY(3%); /* 展開選單 */
}

.success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000000;
    padding: 20px;
    border-radius: 0px;
    text-align: center;
    z-index: 9999;
    background-color: #212121;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 40px auto 0;
    text-align: center;
    font-size: 14px;
    opacity: 0.9;
    width: 100%;
    height: 100%;
}
.message-content{
    background-color: #FFFFFF;
    width: 50%;
    height: 50%;
    left: 25%;
    top: 25%;
    position: fixed;
    border-radius: 20px;
}

.message-content button {
  margin-top: 10px;
  background-color: #f44336;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

.message-content button:hover {
  background-color: #d32f2f;
}
table#detailTable{
    width: 100%;
}
table#detailTable tr td{
    width: auto;
}
table#detailTable tbody tr td input[type="text"]{
    width: 50px;
    padding: 0px 5px 0px 5px;
}
table#detailTable tbody tr td input[type="number"]{
    width: 50px;
    padding: 0px 5px 0px 5px;
}
table#detailTable tbody tr td button[type="button"]{
    width: 50px;
    padding: 0px;
    margin: 0px;
}
table#detailTable tbody tr td:nth-child(2) input[type="text"]{
    width: 230px;
}
table#detailTable tbody tr td:nth-child(4) input[type="text"]{
    width: 60px;
}
table#detailTable tbody tr td:nth-child(6) input[type="text"]{
    width: 30px;
}
table#detailTable tbody tr td:nth-child(8) input[type="text"]{
    width: 30px;
}
table#detailTable tbody tr td:nth-child(9) input[type="text"]{
    width: 50px;
}
table#detailTable tbody tr td:nth-child(13) input[type="text"]{
    width: 50px;
}
table#detailTable tbody tr td {

}
table#detailTable tbody tr td input[type="datetime-local"]{
    width: 100px;
    padding: 5px 10px 5px 10px;
    margin-top: 0px;
    border-radius: 8px;
    border: 1px solid #d2d2d7;
    font-size: 16px;
    background-color: #f5f5f5;
    color: #333;
    transition: border-color 0.3s ease;
    font-family: inherit;
    line-height: 2em;
}
table#detailTable thead tr th:nth-child(1){

}
table#detailTable tr th:nth-child(3){
    width: 50px;
}
table#detailTable tr th:nth-child(5){
    width: 50px;
}
table#listtable-purchase{

}
table#listtable-purchase tbody tr td a{
    background-color: transparent;
}
table#listtable-purchase tbody tr td a:link,table#listtable-purchase tbody tr td a:visited{
    background-color: transparent;
    color: #333333;
    box-shadow: none;
    border: none;

}
table#listtable-purchase tbody tr td a:hover,table#listtable-purchase tbody tr td a:active{
    background-color: transparent;
    color: #333333;
    box-shadow: none;
    border: none;
    text-decoration: underline;
}
form#editForm,form#textbox{
    width: 100%;
    max-width: 100%;
}